<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TiMoch &#187; objc</title>
	<atom:link href="https://timoch.com/blog/tag/objc/feed/" rel="self" type="application/rss+xml" />
	<link>https://timoch.com/blog</link>
	<description>on edge</description>
	<lastBuildDate>Tue, 29 Apr 2014 15:02:50 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.9.40</generator>
	<item>
		<title>Animate a UIView out of thin air</title>
		<link>https://timoch.com/blog/2012/09/animate-a-uiview-out-of-thin-air/</link>
		<comments>https://timoch.com/blog/2012/09/animate-a-uiview-out-of-thin-air/#comments</comments>
		<pubDate>Sat, 15 Sep 2012 12:44:00 +0000</pubDate>
		<dc:creator><![CDATA[timoch]]></dc:creator>
				<category><![CDATA[Mobile Development]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objc]]></category>
		<category><![CDATA[uiview]]></category>

		<guid isPermaLink="false">http://www.timoch.com/blog/?p=88</guid>
		<description><![CDATA[Today, I was trying to animate a menu-like view so that it slides out of a bar of buttons at the bottom of my application. Easy enough, I read some documentation about animations here. And I end up with code similar to this in the controller responsible for the sliding view: [crayon-69e596498700e055513457/] Nothing spectacular. I [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Today, I was trying to animate a menu-like view so that it slides out of a bar of buttons at the bottom of my application.</p>
<p>Easy enough, I read some documentation about animations <a href="http://developer.apple.com/library/ios/#documentation/windowsviews/conceptual/viewpg_iphoneos/animatingviews/animatingviews.html">here</a>. And I end up with code similar to this in the controller responsible for the sliding view:</p>
<p></p><pre class="crayon-plain-tag">CGRect frame = self.view.frame;
// make sure the view initially sits outside the screen
frame.origin.y = 480;
self.view.frame = frame;

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
frame.origin.y = referenceFrame.origin.y - frame.size.height;
self.view.frame = frame;
[UIView commitAnimations];</pre><p> </p>
<p>Nothing spectacular. I make sure the initial view in outside the visible part of the screen and I animate the view into its final position.</p>
<p>Now my view slides up but in my case the final position is on top of another view. So there is content below its final position. My sliding menu ends up sliding up in front of the button bar and all. Not so nice but the solution is simple right ? just animate the height of the view as well. It will appear to slide out of the whichever view you selected as a reference view.</p>
<p></p><pre class="crayon-plain-tag">CGRect final = self.view.frame;

// before animating, set the view height to 0
CGRect initial = final;
initial.origin.y = self.referenceFrame.origin.y;
initial.size.height = 0;
self.view.frame = initial;

[UIView beginAnimations:@"showShareMenu" context:NULL];
[UIView setAnimationDuration:1];
final.origin.y = self.referenceFrame.origin.y - final.size.height;
final.size.height = final.size.height;
self.view.frame = final;
[UIView commitAnimations];</pre><p> </p>
<p>Well not so fast !! my view has kept its initial size. I had to search for a while. My view was not resizing because of its content. In the end, I had to change my views property so that it &#8216;Clips Subviews&#8217;</p>
<p><a href="http://www.timoch.com/blog/wp-content/uploads/2012/09/clip-subviews1.png"><img class="aligncenter size-full wp-image-106" title="clip-subviews" src="http://www.timoch.com/blog/wp-content/uploads/2012/09/clip-subviews1.png" alt="" width="313" height="467" /></a></p>
<p>TiMoch <em>on edge</em></p>
]]></content:encoded>
			<wfw:commentRss>https://timoch.com/blog/2012/09/animate-a-uiview-out-of-thin-air/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transparent background UISearchView</title>
		<link>https://timoch.com/blog/2012/09/transparent-background-uisearchview/</link>
		<comments>https://timoch.com/blog/2012/09/transparent-background-uisearchview/#comments</comments>
		<pubDate>Sat, 08 Sep 2012 13:19:48 +0000</pubDate>
		<dc:creator><![CDATA[timoch]]></dc:creator>
				<category><![CDATA[Mobile Development]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objc]]></category>

		<guid isPermaLink="false">http://www.timoch.com/blog/?p=61</guid>
		<description><![CDATA[While I was working on a small iPhone application I was required to put a search box but with a transparent background. The original design looks like this: I could not get the basic search control to not display its background. I tried using a standard text box, however the look and feel was not [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>While I was working on a small iPhone application I was required to put a search box but with a transparent background. The original design looks like this:</p>
<p style="text-align: center;"><a href="http://www.timoch.com/blog/wp-content/uploads/2012/09/transparent-search-box-design.png"><img class="aligncenter  wp-image-63" title="transparent-search-box-design" alt="" src="http://www.timoch.com/blog/wp-content/uploads/2012/09/transparent-search-box-design.png" width="447" height="67" /></a></p>
<p>I could not get the basic search control to not display its background. I tried using a standard text box, however the look and feel was not the same (the standard text view has round corners but here the whole side needs to a single half-circle).</p>
<p>I found a solution on stackoverflow.com : <a href="http://stackoverflow.com/questions/2913475/uisearchbar-transparent-background-view">http://stackoverflow.com/questions/2913475/uisearchbar-transparent-background-view</a></p>
<p>However, the solutions I found there were not optimal because they required custom code for each usage of a search box with transparent background.</p>
<p>I really wanted a more reusable solution. I adapted one of the solutions but subclassed <pre class="crayon-plain-tag">UISearchBar</pre> as follow:</p>
<p>in UITransparentBackgroundSearchBar.h:</p>
<p><a href="http://www.timoch.com/blog/wp-content/uploads/2012/09/tbsb-h.png"><img title="tbsb-h" alt="" src="http://www.timoch.com/blog/wp-content/uploads/2012/09/tbsb-h.png" width="585" height="102" /></a></p>
<p>and in UITransparentBackgroundSearchBar.m:</p>
<p><a href="http://www.timoch.com/blog/wp-content/uploads/2012/09/tbsb-m.png"><img title="tbsb-m" alt="" src="http://www.timoch.com/blog/wp-content/uploads/2012/09/tbsb-m.png" width="540" height="169" /></a></p>
<p>In your storyboard, set the search bar class to be UITransparentBackgroundSearchBar and voilà.</p>
<p>I am not that experienced with iOS development so there might be a gotcha I have not identified yet. I seems quite clean so I pretty confident.</p>
<p>Have fun,<br />
TiMoch <em>on edge</em></p>
]]></content:encoded>
			<wfw:commentRss>https://timoch.com/blog/2012/09/transparent-background-uisearchview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
