<?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>Notes of a Developer &#187; UIPopoverController</title>
	<atom:link href="http://www.developers-life.com/tag/uipopovercontroller/feed" rel="self" type="application/rss+xml" />
	<link>http://www.developers-life.com</link>
	<description>Develop on Objective-C, UIKit, C, OpenGL for  iPhone, iPad, Mac OS X</description>
	<lastBuildDate>Fri, 03 Feb 2012 11:49:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Samples code for iPad development from apple</title>
		<link>http://www.developers-life.com/samples-code-for-ipad-development-from-apple.html</link>
		<comments>http://www.developers-life.com/samples-code-for-ipad-development-from-apple.html#comments</comments>
		<pubDate>Fri, 29 Jan 2010 12:29:26 +0000</pubDate>
		<dc:creator>Vladimir Boychentsov</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[UIGestureRecognizer]]></category>
		<category><![CDATA[UIKit]]></category>
		<category><![CDATA[UIPopoverController]]></category>

		<guid isPermaLink="false">http://www.developers-life.com/?p=837</guid>
		<description><![CDATA[ToolbarSearch This sample shows how to use a search field in a toolbar. When you start a search, a table view displaying recent searches matching the current search string is displayed in a popover. New controller: 1UIPopoverControllerDelegate Create a navigation controller to contain the recent searches controller, and create the popover controller to contain the [...]]]></description>
			<content:encoded><![CDATA[<h4>ToolbarSearch</h4>
<p>This sample shows how to use a search field in a toolbar. When you start a search, a table view displaying recent searches matching the current search string is displayed in a popover. </p>
<p>New controller:</p>
<div class="codecolorer-container objc geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:810px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">UIPopoverControllerDelegate</div></td></tr></tbody></table></div>
<p><a href="http://gyazo.com/66595120efa983da5d02f7a4a5994e1c.png"><img class="alignnone" src="http://gyazo.com/66595120efa983da5d02f7a4a5994e1c.png" alt="" width="243" height="315" /></a></p>
<p>Create a navigation controller to contain the recent searches controller, and create the popover controller to contain the navigation controller.</p>
<div class="codecolorer-container objc geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:810px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; UINavigationController <span style="color: #002200;">*</span>navigationController <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UINavigationController alloc<span style="color: #002200;">&#93;</span> initWithRootViewController<span style="color: #002200;">:</span>recentSearchesController<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; UIPopoverController <span style="color: #002200;">*</span>popover <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIPopoverController alloc<span style="color: #002200;">&#93;</span> initWithContentViewController<span style="color: #002200;">:</span>navigationController<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; self.recentSearchesPopoverController <span style="color: #002200;">=</span> popover;<br />
&nbsp; &nbsp; recentSearchesPopoverController.delegate <span style="color: #002200;">=</span> self;</div></td></tr></tbody></table></div>
<p><span id="more-837"></span></p>
<p>delegate methods of UIPopoverControllerDelegate</p>
<div class="codecolorer-container objc geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:810px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #11740a; font-style: italic;">/* Called on the delegate when the popover controller will dismiss the popover. Return NO to prevent the dismissal of the view.<br />
&nbsp;*/</span><br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>popoverControllerShouldDismissPopover<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIPopoverController <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>popoverController;<br />
<br />
<span style="color: #11740a; font-style: italic;">/* Called on the delegate when the user has taken action to dismiss the popover. This is not called when -dismissAnimated: is called directly.<br />
&nbsp;*/</span><br />
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>popoverControllerDidDismissPopover<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIPopoverController <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>popoverController;</div></td></tr></tbody></table></div>
<p>&nbsp;</p>
<h4>KeyboardAccessory</h4>
<p>This sample shows how to use a keyboard accessory view.<br />
 You can create the accessory view programmatically (in code), in the same nib file as the view controller&#8217;s main view, or from a separate nib file. This example illustrates the latter; it means the accessory view is loaded lazily &#8212; only if it is required.</p>
<div class="codecolorer-container objc geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:810px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>textViewShouldBeginEditing<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITextView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>aTextView <span style="color: #002200;">&#123;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span style="color: #400080;">NSBundle</span></a> mainBundle<span style="color: #002200;">&#93;</span> loadNibNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;AccessoryView&quot;</span> owner<span style="color: #002200;">:</span>self options<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// Loading the AccessoryView nib file sets the accessoryView outlet.</span><br />
&nbsp; &nbsp; textView.inputAccessoryView <span style="color: #002200;">=</span> accessoryView; &nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #11740a; font-style: italic;">// After setting the accessory view for the text view, we no longer need a reference to the accessory view.</span><br />
&nbsp; &nbsp; self.accessoryView <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #a61390;">return</span> <span style="color: #a61390;">YES</span>;<br />
<span style="color: #002200;">&#125;</span></div></td></tr></tbody></table></div>
<p><img class="aligncenter" src="http://gyazo.com/cd1a224fb78d0ce9016beb18c59a829c.png" alt="" width="485" height="83" /></p>
<p><a href="http://gyazo.com/f906dcf5e949ad544a0b034ef049d219.png">We will get this result</a></p>
<p>&nbsp;</p>
<h4>SimpleGestureRecognizers</h4>
<p>This sample shows how to use standard gesture recognizers.<br />
A view controller creates four gesture recognizers to recognize a tap, a right swipe, a left swipe, and a rotation gesture. When they recognize a gesture, the recognizers send a suitable message to the view controller, which in turn displays an appropriate image at the location of the gesture.</p>
<p>New delegate</p>
<div class="codecolorer-container objc geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:810px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">UIGestureRecognizerDelegate</div></td></tr></tbody></table></div>
<p>Create a rotation gesture recognizer, similar  create a swipe gesture recognizer to recognize right swipes (the default).<br />
 We&#8217;re only interested in receiving messages from this recognizer, and the view will take ownership of it, so we don&#8217;t need to keep a reference to it.</p>
<div class="codecolorer-container objc geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:810px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">recognizer <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIRotationGestureRecognizer alloc<span style="color: #002200;">&#93;</span> initWithTarget<span style="color: #002200;">:</span>self action<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>handleRotationFrom<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #002200;">&#91;</span>self.view addGestureRecognizer<span style="color: #002200;">:</span>recognizer<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #002200;">&#91;</span>recognizer release<span style="color: #002200;">&#93;</span>;</div></td></tr></tbody></table></div>
<p>Create a tap recognizer and add it to the view.<br />
     Keep a reference to the recognizer to test in gestureRecognizer:shouldReceiveTouch:.</p>
<div class="codecolorer-container objc geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:810px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp;recognizer <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UITapGestureRecognizer alloc<span style="color: #002200;">&#93;</span> initWithTarget<span style="color: #002200;">:</span>self action<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>handleTapFrom<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #002200;">&#91;</span>self.view addGestureRecognizer<span style="color: #002200;">:</span>recognizer<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; self.tapRecognizer <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>UITapGestureRecognizer <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>recognizer;<br />
&nbsp; &nbsp; recognizer.delegate <span style="color: #002200;">=</span> self;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #002200;">&#91;</span>recognizer release<span style="color: #002200;">&#93;</span>;</div></td></tr></tbody></table></div>
<p>Get direction in handle method:</p>
<div class="codecolorer-container objc geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:810px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>handleSwipeFrom<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UISwipeGestureRecognizer <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>recognizer <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>recognizer.direction <span style="color: #002200;">==</span> UISwipeGestureRecognizerDirectionLeft<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #002200;">&#125;</span><br />
<span style="color: #002200;">&#125;</span></div></td></tr></tbody></table></div>
<p>In UKit.framework we have few new objects for this:<br />
<a href="http://gyazo.com/b6614f4b29d0d969af6ee613dffe122f.png"><img alt="" src="http://gyazo.com/b6614f4b29d0d969af6ee613dffe122f.png" class="alignnone" width="254" height="138" /></a></p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/t3a1AVoCO5w&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/t3a1AVoCO5w&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>Source: <noindex><a href="http://developer.apple.com" target="_blank">developer.apple.com</a></noindex></p>
]]></content:encoded>
			<wfw:commentRss>http://www.developers-life.com/samples-code-for-ipad-development-from-apple.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

