<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6419346046988748393</id><updated>2026-04-28T02:32:11.552-07:00</updated><category term="IPhone - development - UI"/><category term="IPhone - development - Audio"/><category term="IPhone - development - Library"/><category term="IPhone - development - Text To Speech"/><category term="IPhone - development - data"/><category term="IPhone - development - misc"/><title type='text'>My iPhone development journal- kitchan</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-2993175164739179713</id><published>2011-05-01T11:45:00.000-07:00</published><updated>2011-05-05T23:34:22.312-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - misc"/><title type='text'>Dynamic object creation</title><content type='html'>It seem that there are two ways to create object dynamically:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Create from class name&lt;/li&gt;
&lt;li&gt;Create from class object&lt;/li&gt;
&lt;/ol&gt;1. Create from class name&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Classes are objects as well&amp;nbsp;in objective C. Hence a classs object can be created using class name. Once&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; a&amp;nbsp;class object is created, an normal&amp;nbsp;object can be created from the class object.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; eg.&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [[NSClassFromString(className) alloc] init...]&lt;/em&gt;&amp;nbsp; &lt;/div&gt;&lt;br /&gt;
2. Create from class object&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;The class object can be created from the typical object by sending the class message to the object. Once&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; the class object is created, the typical object can be created from the class object using the typical alloc &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; and init way. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; eg.&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Class classForElement = [MyUserClass class];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;id newObject = [[classForElement alloc] init];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; MyUserClass* object = (MyUserClass *) id;&lt;/em&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/2993175164739179713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/05/dynamic-object-creation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/2993175164739179713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/2993175164739179713'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/05/dynamic-object-creation.html' title='Dynamic object creation'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-6184904612669897196</id><published>2011-04-26T11:13:00.000-07:00</published><updated>2011-04-27T10:03:43.672-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Ways to add new view to current view</title><content type='html'>There are at least 3 ways to add a new view to the current view:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;em&gt;addSubView&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;pushViewController&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;presentModalViewController&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;Below&amp;nbsp;are some comparisons between the above methods:&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;border-collapse: collapse; mso-padding-alt: 0in 0in 0in 0in; mso-yfti-tbllook: 1184;&quot;&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 17.5pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0;&quot;&gt;&lt;td style=&quot;background: #1f497d; border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; height: 17.5pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 119.7pt;&quot; valign=&quot;top&quot; width=&quot;160&quot;&gt;&lt;br /&gt;
&lt;div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Feature&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;background: #1f497d; border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; height: 17.5pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 191.55pt;&quot; valign=&quot;top&quot; width=&quot;255&quot;&gt;&lt;br /&gt;
&lt;div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span class=&quot;SpellE&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;addSubView&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: white; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;/&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span class=&quot;SpellE&quot;&gt;&lt;strong&gt;&lt;span style=&quot;color: white; font-family: &amp;quot;Calibri&amp;quot;, &amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;insertSubView&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: white; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;background: #1f497d; border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; height: 17.5pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 119.7pt;&quot; valign=&quot;top&quot; width=&quot;160&quot;&gt;&lt;br /&gt;
&lt;div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span class=&quot;SpellE&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;pushViewController&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;background: #1f497d; border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; height: 17.5pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 148.05pt;&quot; valign=&quot;top&quot; width=&quot;197&quot;&gt;&lt;br /&gt;
&lt;div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span class=&quot;SpellE&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;presentModalViewController&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 1;&quot;&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 119.7pt;&quot; valign=&quot;top&quot; width=&quot;160&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, &amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Usage&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 191.55pt;&quot; valign=&quot;top&quot; width=&quot;255&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, &amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;It is typically &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, &amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;use&amp;nbsp;to create&amp;nbsp;view&amp;nbsp;&lt;span class=&quot;SpellE&quot;&gt;heirarchy&lt;/span&gt;&lt;br /&gt;
programmatically. A view heirarchy will consist of multiple subviews that make up different components in the view.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;, &amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Each sub view will has its own draw and animation handling.&lt;br /&gt;
Each sub view also &lt;span class=&quot;SpellE&quot;&gt;has&lt;/span&gt; its own event handling. &lt;span style=&quot;color: red;&quot;&gt;Alternatively, view &lt;span class=&quot;SpellE&quot;&gt;heirarchy&lt;/span&gt; can&lt;br /&gt;
be created using Interface Builder.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 119.7pt;&quot; valign=&quot;top&quot; width=&quot;160&quot;&gt;In many IPhone application, the user will need to go through different pages of form / view to complete a specific workflow for a task.&amp;nbsp;Typically, pushViewController is used to&amp;nbsp;step&amp;nbsp;the user through the different pages to complete the task. It is usually&amp;nbsp;work with navigation controller.&amp;nbsp;Push view controller will create the visual effect of push page left to right.&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 148.05pt;&quot; valign=&quot;top&quot; width=&quot;197&quot;&gt;In some IPhone application, while performing a task,&amp;nbsp;the user will need to complete a self-contained&amp;nbsp;subtask before he can continue the task. Modal view mechanism can be used to accomplish the subtask function. By default, the present modal viewController will slide a set of controls from bottom to top to the current view. The modal view need to be dismissed before the user can continue with the current view.&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 2;&quot;&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 119.7pt;&quot; valign=&quot;top&quot; width=&quot;160&quot;&gt;Compatibility with &lt;span class=&quot;SpellE&quot;&gt;navigationController&lt;/span&gt; &lt;span class=&quot;SpellE&quot;&gt;tabBarController&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 191.55pt;&quot; valign=&quot;top&quot; width=&quot;255&quot;&gt;Usually the subview will be added to the top of the current view, hence &lt;span class=&quot;GramE&quot;&gt;cover the navigation bar. &lt;/span&gt;The toolbar may also&amp;nbsp;be covered depending on&amp;nbsp; the size of the subview. The subview can use setFrame to position it below the navigation controller.&lt;br /&gt;
Eg:&lt;br /&gt;
&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; color: black;&quot;&gt;[&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;view&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;setFrame&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;CGRectMake&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;0&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;60&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;320&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;400&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;)];&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 119.7pt;&quot; valign=&quot;top&quot; width=&quot;160&quot;&gt;Work well with &lt;span class=&quot;SpellE&quot;&gt;tabBarController&lt;/span&gt;, &lt;span class=&quot;SpellE&quot;&gt;navigationController&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 148.05pt;&quot; valign=&quot;top&quot; width=&quot;197&quot;&gt;Both controllers will be hidden from the modal view. Except for &lt;span class=&quot;SpellE&quot;&gt;partialCurl&lt;/span&gt; &lt;span class=&quot;SpellE&quot;&gt;transitionStyle&lt;/span&gt;. &lt;span class=&quot;GramE&quot;&gt;which&lt;/span&gt; the &lt;span class=&quot;SpellE&quot;&gt;NavigationBar&lt;/span&gt; will&lt;br /&gt;
still be visible.&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 3;&quot;&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 119.7pt;&quot; valign=&quot;top&quot; width=&quot;160&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Return back from the added view&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 191.55pt;&quot; valign=&quot;top&quot; width=&quot;255&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Has to implement return mechanism.&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 119.7pt;&quot; valign=&quot;top&quot; width=&quot;160&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Can have automatic back button created&lt;span class=&quot;GramE&quot;&gt;&lt;br /&gt;
if&lt;/span&gt; the root Controller is navigation controller and the back &lt;span class=&quot;SpellE&quot;&gt;barButtonItem&lt;/span&gt; is created in the root navigation&lt;br /&gt;
controller. &lt;span style=&quot;color: red;&quot;&gt;** For default back button to work, each&lt;br /&gt;
view must &lt;span class=&quot;GramE&quot;&gt;has&lt;/span&gt; title &lt;span class=&quot;SpellE&quot;&gt;setted&lt;/span&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 148.05pt;&quot; valign=&quot;top&quot; width=&quot;197&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Has to implement return mechanism.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 4;&quot;&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 119.7pt;&quot; valign=&quot;top&quot; width=&quot;160&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Sample code:&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0pt;&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Add &lt;span class=&quot;SpellE&quot;&gt;newViewController&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 191.55pt;&quot; valign=&quot;top&quot; width=&quot;255&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;[&lt;span class=&quot;SpellE&quot;&gt;self.viewController.view&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;SpellE&quot;&gt;addSubView&lt;/span&gt;: &lt;span class=&quot;SpellE&quot;&gt;newViewController.view&lt;/span&gt;];&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 119.7pt;&quot; valign=&quot;top&quot; width=&quot;160&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;[&lt;span class=&quot;SpellE&quot;&gt;self.viewController&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;SpellE&quot;&gt;pushViewController&lt;/span&gt;: &lt;span class=&quot;SpellE&quot;&gt;newViewController&lt;/span&gt;];&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 148.05pt;&quot; valign=&quot;top&quot; width=&quot;197&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;[&lt;span class=&quot;SpellE&quot;&gt;self.viewController&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;SpellE&quot;&gt;presentModalViewController&lt;/span&gt;: &lt;span class=&quot;SpellE&quot;&gt;newViewController&lt;/span&gt;];&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 5; mso-yfti-lastrow: yes;&quot;&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 119.7pt;&quot; valign=&quot;top&quot; width=&quot;160&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Sample code:&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Remove&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span class=&quot;SpellE&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;newViewController&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 191.55pt;&quot; valign=&quot;top&quot; width=&quot;255&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;[&lt;span class=&quot;SpellE&quot;&gt;self.view&lt;/span&gt; &lt;span class=&quot;SpellE&quot;&gt;removeFromSuperView&lt;/span&gt;];&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 119.7pt;&quot; valign=&quot;top&quot; width=&quot;160&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;[&lt;span class=&quot;SpellE&quot;&gt;self.viewController&lt;/span&gt; &lt;span class=&quot;SpellE&quot;&gt;popViewController&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Animated: YES];&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 148.05pt;&quot; valign=&quot;top&quot; width=&quot;197&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;[self &lt;span class=&quot;SpellE&quot;&gt;dismissModalViewController&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Animated: YES];&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/6184904612669897196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/04/ways-to-add-new-view-to-current-view.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/6184904612669897196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/6184904612669897196'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/04/ways-to-add-new-view-to-current-view.html' title='Ways to add new view to current view'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-1847695512348188288</id><published>2011-04-19T09:28:00.000-07:00</published><updated>2011-04-26T12:16:58.689-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Creating Modal View</title><content type='html'>&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;In&amp;nbsp;a&amp;nbsp;typical Windows environment, modal window is a child&amp;nbsp;or popup window where user can&amp;nbsp;not press on any control on the parent window&amp;nbsp;before complete and close the child or popup modal window.&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;For IPhone or IPad&amp;nbsp;application, modal view behave the same. Sometime it is neccessary to popup a modal view to the user for data entry or other action view which the user has to complete the data entry&amp;nbsp;view before the user can proceed to other part of the application. &lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;The following steps outline how such modal view can be acheived:&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQCDdbbAymiPNctwuSzhB3dpUz4JikjRnBTpo3Rc5czAzNrFePmKtQkPJt54Oq9Et4y9mv0eIv622RNTTfm8ZAcs2DZkucQETlEV76Ua7xtcup19YD-irpccvFfBIjI-ZV9WUGuLLaRBs/s1600/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-04-20-00-08-45.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; cssfloat: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;136&quot; i8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQCDdbbAymiPNctwuSzhB3dpUz4JikjRnBTpo3Rc5czAzNrFePmKtQkPJt54Oq9Et4y9mv0eIv622RNTTfm8ZAcs2DZkucQETlEV76Ua7xtcup19YD-irpccvFfBIjI-ZV9WUGuLLaRBs/s200/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-04-20-00-08-45.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;1. Create a &lt;em&gt;UIViewController&lt;/em&gt; subclass, by &lt;em&gt;New File -&amp;gt; Cocoa&amp;nbsp;&amp;nbsp; touch -&amp;gt; UIViewController subclass.&lt;/em&gt; &lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ensure that the &quot;With XIB for user interface&quot; option is selected.&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;eg.&amp;nbsp; create a &lt;em&gt;UIViewController &lt;/em&gt;subclass -&amp;gt; &lt;em&gt;ModalController&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;br /&gt;
2. Use&amp;nbsp;interface builder&amp;nbsp;to create the needed UI in the created &lt;em&gt;ModalController.&lt;/em&gt;&lt;/div&gt;&lt;br /&gt;
3. Add the following modal view invocation code in the appropiate section:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;ModalController*&amp;nbsp;modal = [[ModalController alloc] initWithNibName:Nil bundle:Nil];&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;[modal setModalTransitionStyle:UIModalTransitionStyle&lt;span style=&quot;color: #2e0d6e; font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;color: #2e0d6e; font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;color: #2e0d6e; font-family: Menlo-Regular; font-size: small;&quot;&gt;PartialCurl&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;];&amp;nbsp; // this will determine how the modal transition in&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;[modal setModalPresentationStyle:UIModalPresentationFullScreen];&amp;nbsp; // this will how the modal will be presented&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;[self.navigationController presentModalViewController:modal animated:YES];&lt;/em&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;4. Add the following modal view removal code in the appropiate section, eg. link to the exit button of the ModalController:&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;- (IBAction) backToMain: (id) sender { &lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [self dismissModalViewControllerAnimated:YES];&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;}&lt;/em&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj19Q0WGwIaUyMcgNG2xj7Jy09gnyfKET4QBtN5cAM7uVAEfsAYh9XLCGE_zUaOBN8h4_rb7uGuv6o0pyFXJ3TePVAzKGKzp7bsUV_sTUt3YRUDlA4oKKDMS46QzE3EjAwPg45Z2y1_Nso/s1600/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-04-20-00-27-18.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; i8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj19Q0WGwIaUyMcgNG2xj7Jy09gnyfKET4QBtN5cAM7uVAEfsAYh9XLCGE_zUaOBN8h4_rb7uGuv6o0pyFXJ3TePVAzKGKzp7bsUV_sTUt3YRUDlA4oKKDMS46QzE3EjAwPg45Z2y1_Nso/s320/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-04-20-00-27-18.png&quot; width=&quot;214&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/1847695512348188288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/04/creating-modal-view.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/1847695512348188288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/1847695512348188288'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/04/creating-modal-view.html' title='Creating Modal View'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQCDdbbAymiPNctwuSzhB3dpUz4JikjRnBTpo3Rc5czAzNrFePmKtQkPJt54Oq9Et4y9mv0eIv622RNTTfm8ZAcs2DZkucQETlEV76Ua7xtcup19YD-irpccvFfBIjI-ZV9WUGuLLaRBs/s72-c/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-04-20-00-08-45.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-111674127104770976</id><published>2011-04-18T20:20:00.000-07:00</published><updated>2011-04-18T20:26:07.517-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Creating application without status bar</title><content type='html'>The status bar in an iphone application shows the network connections (Telco, WIFI, bluetooth.. etc), date, battery usage, location icon... etc.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiM4YWG4L_Wq7lt6sfnHlruNKyEgMMWQbh6kxlFdNaRbUn4de7_ejF9tYFtN0Xkrg_9jTzA1mCbmCYcfzMUHmtKIzYtMg5LJ59I_c9MG1ro6A-RlUCg2SwCB5FYCRW9anN3kc2F8fJ8OOE/s1600/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-04-19-10-58-05.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;27&quot; r6=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiM4YWG4L_Wq7lt6sfnHlruNKyEgMMWQbh6kxlFdNaRbUn4de7_ejF9tYFtN0Xkrg_9jTzA1mCbmCYcfzMUHmtKIzYtMg5LJ59I_c9MG1ro6A-RlUCg2SwCB5FYCRW9anN3kc2F8fJ8OOE/s320/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-04-19-10-58-05.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;For some application, it may be usefull to hide the status bar so that the application has maximum screen area.&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;To hide the status bar, send the &lt;em&gt;setStatusBarHidden &lt;/em&gt;message to the &lt;em&gt;UIApplication&lt;/em&gt; object. It should be send in the &lt;em&gt;UIApplication&lt;/em&gt;&#39;s&lt;em&gt; didFinishLaunchingWithOptions&lt;/em&gt; method. This method will be invoked when the application finish launching.&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;eg.&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;launchOptions&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.....&amp;nbsp; &lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;[[UIApplication sharedApplication]setStatusBarHidden:YES];&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .......&lt;br /&gt;
&amp;nbsp;&amp;nbsp; }&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/111674127104770976/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/04/creating-application-without-status-bar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/111674127104770976'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/111674127104770976'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/04/creating-application-without-status-bar.html' title='Creating application without status bar'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiM4YWG4L_Wq7lt6sfnHlruNKyEgMMWQbh6kxlFdNaRbUn4de7_ejF9tYFtN0Xkrg_9jTzA1mCbmCYcfzMUHmtKIzYtMg5LJ59I_c9MG1ro6A-RlUCg2SwCB5FYCRW9anN3kc2F8fJ8OOE/s72-c/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-04-19-10-58-05.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-4619497459113386573</id><published>2011-04-10T09:40:00.000-07:00</published><updated>2011-04-26T12:22:06.892-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Creating UITableView</title><content type='html'>The following steps show how to create &lt;em&gt;UITableView&lt;/em&gt; in a iPhone application, it is very similar to the &lt;em&gt;UIPickerView&lt;/em&gt; implementation:&lt;br /&gt;
1. Create the &lt;em&gt;UITableView&lt;/em&gt; in interface builder.&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;2. Add the &lt;em&gt;IBOutlet&lt;/em&gt; for &lt;em&gt;UITableView&lt;/em&gt; in the interface (.h) file.&amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt;(optional, if the UITableView is needed to reference in the code)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;3. Link the &lt;em&gt;IBOutlet&lt;/em&gt; for &lt;em&gt;UITableView&lt;/em&gt; to the &lt;em&gt;UITableView&lt;/em&gt; in interface builder. &lt;span style=&quot;color: red;&quot;&gt;(optional, only&amp;nbsp;if the&amp;nbsp;&lt;em&gt;IBOutlet&lt;/em&gt; is created in step2)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;4. Implement the following&amp;nbsp;datasource and delegate&amp;nbsp;methods for basic browsing function:&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.&amp;nbsp; &lt;em&gt;numberOfRowsInSection&lt;/em&gt; datasource method should return the number of row in the table.&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eg.&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&lt;em&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #002200;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;NSInteger&lt;span style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;tableView&lt;span style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;UITableView &lt;span style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #002200;&quot;&gt;) &lt;/span&gt;tableView numberOfRowsInSection&lt;span style=&quot;color: #002200;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;NSInteger&lt;span style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;section {&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return [array count];&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/em&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; b.&amp;nbsp; &lt;em&gt;cellForRowAtIndexPath&lt;/em&gt; datasource method should return a table cell for the row at the &lt;em&gt;indexPath&lt;/em&gt; for the table.&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eg.&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - &lt;span style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;UITableViewCell &lt;span style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;tableView&lt;span style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;UITableView &lt;span style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;tableView cellForRowAtIndexPath&lt;span style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #002200;&quot;&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style=&quot;color: #002200;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/span&gt;&lt;span style=&quot;color: #400080;&quot;&gt;NSIndexPath&lt;/span&gt; &lt;span style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;indexPath {&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@&quot;Cell&quot;];&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (cell==NULL) {&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@&quot;Cell&quot;] &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; autorelease];&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cell.text= [array objectAtIndex:indexPath.row];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // cell.text is deprecated&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return cell;&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/em&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; c. &lt;em&gt;numberOfSectionsInTableView&lt;/em&gt; datasource method should return the number of sections in the &lt;em&gt;UItableView.&lt;/em&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Optional, only for multiple section UITableView)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eg.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return numberOfSections;&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/em&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; d. &lt;em&gt;titleForHeaderInSection&lt;/em&gt; datasource method should return the&amp;nbsp;header of the section.&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;(Optional, only needed for multiple sections UITableView)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eg.&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {&lt;/em&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (section == 0)&amp;nbsp;&amp;nbsp; return @&quot;section 1&quot;;&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (section ==1)&amp;nbsp;&amp;nbsp; return @&quot;section 2&quot;;&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // more code to return header ...... &lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/em&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.&lt;em&gt; didSelectRowAtIndexPath&lt;/em&gt;&amp;nbsp;delegate method would be called if the user selected a row in the &lt;em&gt;UITableView&lt;/em&gt;.&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(Optional, only needed if there are actions to be performed when user selected a row)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eg.&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&lt;span style=&quot;color: #002200;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&lt;/span&gt; &lt;span style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #a61390;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;tableView&lt;span style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;UITableView &lt;span style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;tableView didSelectRowAtIndexPath&lt;span style=&quot;color: #002200;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #002200;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #400080;&quot;&gt;NSIndexPath&lt;/span&gt; &lt;span style=&quot;color: #002200;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #002200;&quot;&gt;)&lt;/span&gt;indexPath {&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // actions to be performed...&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // indexPath.section will give the selected&amp;nbsp;section&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // indexPath.row will give the selected row&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // can implement show detail view....&lt;/em&gt;&lt;/div&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;span style=&quot;color: #002200;&quot;&gt;&lt;/span&gt;&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f. accessoryTypeForRow&amp;nbsp;delegate method should return the type of accessory (like button, arrow...). &lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Optional, only needed if button or arrow accessory is needed to display at the side)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eg.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;em&gt; - (UITableViewCellAccessoryType)tableView:(UITableView *)tableView &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //return UITableViewCellAccessoryDetailDisclosureButton;&amp;nbsp;&amp;nbsp; &lt;/em&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiK7sqo78thdruwcWKbNzPdJNmlOi8cjiFBHch-mZp_Aq4jcHUFGSqy5BURcXKdcr906Puc03bAtPE1M8_896_cwe-YRCK7WeW_heq_U1vSOpwWRLkM49DLPnriOrntSuggKZhPxxVbTZ4/s1600/button.png&quot; imageanchor=&quot;1&quot; style=&quot;height: 25px; margin-left: 1em; margin-right: 1em; width: 18px;&quot;&gt;&lt;img border=&quot;0&quot; r6=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiK7sqo78thdruwcWKbNzPdJNmlOi8cjiFBHch-mZp_Aq4jcHUFGSqy5BURcXKdcr906Puc03bAtPE1M8_896_cwe-YRCK7WeW_heq_U1vSOpwWRLkM49DLPnriOrntSuggKZhPxxVbTZ4/s1600/button.png&quot; /&gt;&lt;/a&gt;&lt;em&gt;&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/em&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //return UITableViewCellAccessoryDisclosureIndicator; &lt;/em&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUX7x1nS8Cu0ssDD8h21hxZ0xyQ93eVrbCgpUF0ggNEBXmRrLttOiZcqqPgBBdTG77oU0XoOrw3L5AsfgWY7qVmmuyytctt3GJjpL3jKeU35oKEKcIucUPDzGShopbn0Re9lJULDR4ERY/s1600/arrow.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; r6=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUX7x1nS8Cu0ssDD8h21hxZ0xyQ93eVrbCgpUF0ggNEBXmRrLttOiZcqqPgBBdTG77oU0XoOrw3L5AsfgWY7qVmmuyytctt3GJjpL3jKeU35oKEKcIucUPDzGShopbn0Re9lJULDR4ERY/s1600/arrow.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&lt;/em&gt;&amp;nbsp;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //return&amp;nbsp;UITableViewCellAccessoryNone;&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//return UITableViewCellAccessoryCheckmark;&amp;nbsp;&amp;nbsp; &lt;/em&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgROUq2t9RjP_EZ7Sl95fAYdWO_xb5LUJyL6g3X1qlm7RCCtOcGfCwDrFXuAZfTNeh0XbgaXDDMwoVFuZiZQzT-j-5T9WFoSA3fg9otfK21Ofq0DUpIPRSTuD51Aopr502fABg_WBVFz4Y/s1600/mark.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; r6=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgROUq2t9RjP_EZ7Sl95fAYdWO_xb5LUJyL6g3X1qlm7RCCtOcGfCwDrFXuAZfTNeh0XbgaXDDMwoVFuZiZQzT-j-5T9WFoSA3fg9otfK21Ofq0DUpIPRSTuD51Aopr502fABg_WBVFz4Y/s1600/mark.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/em&gt;&lt;/div&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g. &lt;em&gt;accessoryButtonTappedForRowWithIndexPath&lt;/em&gt; delegate method&amp;nbsp;would&amp;nbsp;be invoked when the user clicked on the&amp;nbsp;accessoryButton.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;&amp;nbsp;(Optional, only needed if button in step f is setted)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eg.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (NSIndexPath *)indexPath {&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // invoke a method here&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // eg. [self tableView:tableView didSelectRowAtIndexPath:indexPath];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/em&gt;&lt;/div&gt;5.&amp;nbsp;The following steps describe how to implement delete function for&amp;nbsp;&lt;em&gt;UITableView&lt;/em&gt;:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; a. Set the tableView into editing mode. There are two ways to set a tableView into editing mode:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i.&amp;nbsp;&lt;em&gt;tableView.editing&lt;/em&gt; property set to &lt;em&gt;YES&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/em&gt;eg.&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;em&gt;tableView.editing = YES; &lt;/em&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;em&gt; or [tableView setEditing:YES animated:YES]&lt;/em&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ii. If the &lt;em&gt;tableView &lt;/em&gt;has implmented with &lt;em&gt;UINavigationController&lt;/em&gt;, set the &lt;em&gt;navigationBarButton&lt;/em&gt; (left or right) to &lt;em&gt;editButtonItem&lt;/em&gt;. This will allow toggle the &lt;em&gt;tableView &lt;/em&gt;into editing mode.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;eg.&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;em&gt;self.navigationItem.rightBarButtonItem = self.editButtonItem;&lt;/em&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;b. Implement the &lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;em&gt;commitEditingStyle&lt;/em&gt; datasource method. This method will be invoked, when a &lt;em&gt;tableView&lt;/em&gt; item is deleted.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eg.&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &lt;em&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;pun&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;tableView&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;UITableView&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;*)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;tableView commitEditingStyle&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;em&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;pun&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;span class=&quot;typ&quot;&gt;&lt;em&gt;&lt;span style=&quot;color: black;&quot;&gt;UITableViewCellEditingStyle&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;editingStyle forRowAtIndexPath&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:(&lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;NSIndexPath&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;*)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;indexPath &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;editingStyle &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;UITableViewCellEditingStyleDelete&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;typ&quot;&gt;&lt;span class=&quot;pln&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; // ... delete code here ....&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;pun&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;span class=&quot;pun&quot;&gt;&lt;em&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;6. Link the UITableView&#39;s datasource and delegate&amp;nbsp;to the&amp;nbsp;code that implement the above datasource and&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; delegate methods.&lt;br /&gt;
&lt;br /&gt;
7. The tableView can be set with different background color using the setBackgroundColor method.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Eg.&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;[self.tableView setBackgroundColor:[UIColor groupTableViewBackgroundColor]];&lt;/em&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/4619497459113386573/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/04/creating-uitableview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/4619497459113386573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/4619497459113386573'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/04/creating-uitableview.html' title='Creating UITableView'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiK7sqo78thdruwcWKbNzPdJNmlOi8cjiFBHch-mZp_Aq4jcHUFGSqy5BURcXKdcr906Puc03bAtPE1M8_896_cwe-YRCK7WeW_heq_U1vSOpwWRLkM49DLPnriOrntSuggKZhPxxVbTZ4/s72-c/button.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-1587674455972203622</id><published>2011-03-24T12:18:00.000-07:00</published><updated>2011-04-10T08:59:09.937-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - Library"/><title type='text'>Using static library</title><content type='html'>To reduce and reuse common code across multiple development projects, the typical development pattern is to use library. Typically library can be static or dynamic, however IPhone development only support static library. The following steps briefly describe how this can be done.&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJnAfLItm878QNcBD15r4GKYY-8Ros3FJHoZ2_QGIFkcC51KKgbwm4XAZ7sVkcUmji_lEzqB9Cep9zlTsf1l4JJ8TE3nzi8i7ZdroJrspXoVdSnTzsw7rqtZpyvUIviPIrfmCNP_6z4CY/s1600/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-03-25-01-36-05.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; cssfloat: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;133&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJnAfLItm878QNcBD15r4GKYY-8Ros3FJHoZ2_QGIFkcC51KKgbwm4XAZ7sVkcUmji_lEzqB9Cep9zlTsf1l4JJ8TE3nzi8i7ZdroJrspXoVdSnTzsw7rqtZpyvUIviPIrfmCNP_6z4CY/s200/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-03-25-01-36-05.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;1. Create&amp;nbsp;the xcode static library project&amp;nbsp;using the &lt;em&gt;File-&amp;gt;New-&amp;gt;New Project&lt;/em&gt;. Choose &lt;em&gt;Cocoa Touch Static Library&lt;/em&gt;, under the &lt;em&gt;Framework and Library&lt;/em&gt; tab. Follow through the steps to specify the name and location to complete the static library creation process. Add the source files and header files. Ensure that the project can be build successfully.&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
2.&amp;nbsp;&amp;nbsp;In the project that need to use the above created&amp;nbsp;static library, add the static library &lt;span style=&quot;background-color: white; color: red;&quot;&gt;project&lt;/span&gt; file (eg.&amp;nbsp;&lt;em&gt;MyStaticLib.xcodeproj&lt;/em&gt; file)&amp;nbsp;by using the &lt;em&gt;Add File to &quot;MyProject&quot; ...&lt;/em&gt; menu. Make sure&amp;nbsp;to choose the following option:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Uncheck &lt;/strong&gt;the &lt;em&gt;Destination - Copy files into destination folder (if neccessary)&lt;/em&gt; option. This will ensure that the physical files in the static library project is not copied and only the reference to the static library project is created. &lt;/li&gt;
&lt;li&gt;Select the &lt;em&gt;create group for any added folders&lt;/em&gt; option under the &lt;em&gt;Folder&lt;/em&gt;&amp;nbsp;selection. **&lt;em&gt;create folder references&amp;nbsp;for any added folders&lt;/em&gt; option seem to work as well.&lt;/li&gt;
&lt;/ul&gt;Once the static library project reference is created, the folder structure will be created under the project file as well.&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6CRBowaIZT2oW3E40Ix0J5icmOMmJC1c_gVp6GcNNiDRW422mssqXMQzTyZpr0WlF_8ua0J63K4s19fBeMZVWXcKN07NUUzseeLQEIh83Nf5qHII-a56Yww4GlEyHzJ4ppwEfd-GJ-wg/s1600/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-03-25-02-48-25.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; cssfloat: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;126&quot; r6=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6CRBowaIZT2oW3E40Ix0J5icmOMmJC1c_gVp6GcNNiDRW422mssqXMQzTyZpr0WlF_8ua0J63K4s19fBeMZVWXcKN07NUUzseeLQEIh83Nf5qHII-a56Yww4GlEyHzJ4ppwEfd-GJ-wg/s200/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-03-25-02-48-25.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
3. Add the static library project into the &lt;em&gt;target dependencies&lt;/em&gt; section of the project. &lt;br /&gt;
Also add the static library archeive file (eg. libXXX.a) into the&amp;nbsp;&lt;em&gt;Link binary with library&lt;/em&gt; section. Make sure that all the iPhone &lt;em&gt;framework&amp;nbsp;&lt;/em&gt;(eg. AVFoundation)&amp;nbsp;that is needed by the static library&#39;s codes are added to the &lt;em&gt;Link binary with library&lt;/em&gt; section as well.&lt;br /&gt;
&lt;br /&gt;
4. The header file for the static library project can be added to the source code in the target project by either of the following way:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Use of&amp;nbsp;absolute path to the static library project (eg. import &quot;/user/admin/XXX/xxx.h&quot;).&lt;/li&gt;
&lt;li&gt;Use of relative path to the static library project (eg. import &quot;xxx.h&quot;), but make sure that&amp;nbsp;the absolute path to the static library include files are added to the&amp;nbsp;&lt;em&gt;&lt;span style=&quot;color: red;&quot;&gt;User header search paths&lt;/span&gt;&lt;/em&gt; section for the target project&#39;s &lt;em&gt;build setting&lt;/em&gt; tag under &lt;em&gt;search path&lt;/em&gt; section.&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;&lt;/div&gt;Make sure that the target project is recompiled without any library and test the code accordingly.</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/1587674455972203622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/03/using-static-library.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/1587674455972203622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/1587674455972203622'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/03/using-static-library.html' title='Using static library'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJnAfLItm878QNcBD15r4GKYY-8Ros3FJHoZ2_QGIFkcC51KKgbwm4XAZ7sVkcUmji_lEzqB9Cep9zlTsf1l4JJ8TE3nzi8i7ZdroJrspXoVdSnTzsw7rqtZpyvUIviPIrfmCNP_6z4CY/s72-c/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-03-25-01-36-05.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-7172027541257969648</id><published>2011-03-20T08:37:00.000-07:00</published><updated>2011-04-10T11:14:00.020-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Creating UIPickerView</title><content type='html'>The following steps&amp;nbsp;outline how to&amp;nbsp;create a &lt;em&gt;UIPickerView&lt;/em&gt;&amp;nbsp;in an iPhone application.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVOMyv-07TdiE5GnkxnFZaLWwOsK7XajeR36zVxj_O5byNXU__OeHxqtZmeghmSo-SoCCfmyNmfLzGqrAgkLcC9j3NEFAwSbVDf3JdxqOrNLGe5OoZYSNZbODu9hWoa25848DqmmXniRY/s1600/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-03-20-22-33-11.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; cssfloat: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; r6=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVOMyv-07TdiE5GnkxnFZaLWwOsK7XajeR36zVxj_O5byNXU__OeHxqtZmeghmSo-SoCCfmyNmfLzGqrAgkLcC9j3NEFAwSbVDf3JdxqOrNLGe5OoZYSNZbODu9hWoa25848DqmmXniRY/s200/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-03-20-22-33-11.png&quot; width=&quot;164&quot; /&gt;&lt;/a&gt;&lt;/div&gt;1. Create the &lt;em&gt;UIPickerView&lt;/em&gt; in Interface Builder.&lt;br /&gt;
2. Add the &lt;em&gt;IBOutlet&lt;/em&gt; for the &lt;em&gt;UIPickerView&lt;/em&gt; in the interface file (.h)&amp;nbsp;for the view. Add the &lt;em&gt;@synthesis&lt;/em&gt; for the &lt;em&gt;IBOutlet&lt;/em&gt; in the objective c code (.m) for the view.&lt;span style=&quot;color: red;&quot;&gt; (Optional, if the UIPickerView is needed to reference in the code)&lt;/span&gt;&lt;br /&gt;
eg. in the interface (.h) file&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;@interface&amp;nbsp;controller : UIViewController {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IBOutlet UIPickerView *picker;&lt;br /&gt;
}&lt;br /&gt;
@property (nonatomic, retain) IBOutlet UIPickerView *picker;&lt;/div&gt;&lt;br /&gt;
eg. in the implementation code (.m) file&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;@synthesize picker;&lt;/div&gt;3. Link the picker IBOutlet to the UIPickerView in Interface Builder. &lt;span style=&quot;color: red;&quot;&gt;(optional&amp;nbsp;only if step 2 is followed)&lt;/span&gt;&lt;br /&gt;
4.&lt;span style=&quot;background-color: red;&quot;&gt; &lt;span style=&quot;color: white;&quot;&gt;The following 1 delegate and 3 datasource methods&amp;nbsp;need to be implemented: &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
a. &lt;em&gt;numberOfComponentsInPickerView, &lt;/em&gt;this datasource method should return the number of components in the UIPickerView.&lt;span style=&quot;color: red;&quot;&gt; (Optional, only needed for multiple components UIPickerView)&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; eg:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp; - (NSInteger) numberOfComponentsInPickerView: (UIPickerView *)thePickerView {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return numberOfComponentsInPickerView;&amp;nbsp; // this should return the number of components in the UIPickerView&lt;br /&gt;
&amp;nbsp;&amp;nbsp; }&lt;/div&gt;b. &lt;em&gt;numberOfRowsInComponent, &lt;/em&gt;this datasource method should return the number of rows in the component.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; eg:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -(NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent: (NSInteger) component {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return [componentArray count];&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;c.&lt;em&gt; titleForRow&lt;/em&gt;, this datasource method should return the title of the row in the picker view&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; eg:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-(NString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:&amp;nbsp;(NSInteger) component {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return [componentArray objectAtIndex:row];&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;br /&gt;
d. &lt;em&gt;didSelectRow, &lt;/em&gt;this delegated method&amp;nbsp;will be invoked when user select the item in the picker view.&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Optional, only needed if some action is needed to perform when user select the item on the UIPickerView)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: red; color: white;&quot;&gt;* When there are multiple components in the picker, this method is&amp;nbsp;only called once, when two components are turned together.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; eg:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -(void)pickerView:(UIPickerView *)thePickerView didSelectRow: (NSInteger)row inComponent: (NSInteger) component&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;selectedIndex = row;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;&lt;br /&gt;
5. Link the datasource and delegate&amp;nbsp;for the UIPickerView to the delegate implementation in the Interface Builder.</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/7172027541257969648/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/03/creating-uipickerview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/7172027541257969648'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/7172027541257969648'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/03/creating-uipickerview.html' title='Creating UIPickerView'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVOMyv-07TdiE5GnkxnFZaLWwOsK7XajeR36zVxj_O5byNXU__OeHxqtZmeghmSo-SoCCfmyNmfLzGqrAgkLcC9j3NEFAwSbVDf3JdxqOrNLGe5OoZYSNZbODu9hWoa25848DqmmXniRY/s72-c/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-03-20-22-33-11.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-8033866265524897630</id><published>2011-03-20T05:19:00.000-07:00</published><updated>2011-05-06T01:29:15.263-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - data"/><title type='text'>Loading NSArray or NSDictionary with plist file</title><content type='html'>The content of &lt;em&gt;NSArray&lt;/em&gt; and &lt;em&gt;NSDictionary&lt;/em&gt; can be loaded from plist file.&lt;br /&gt;
The following steps can be used to do that:&lt;br /&gt;
1. Create the plist file, by adding new property List file from the resource option.&lt;br /&gt;
&lt;br /&gt;
2. &lt;strong&gt;By default&lt;/strong&gt;, the newly created property list file is of type &lt;strong&gt;dictionary &amp;lt;dict&amp;gt;&lt;/strong&gt;. Change it to&lt;strong&gt; array&lt;/strong&gt; &amp;lt;array&amp;gt; if&amp;nbsp;&lt;em&gt;NSArray&lt;/em&gt; is needed. Add in the key and value for dictionary or value for array.&lt;br /&gt;
&lt;br /&gt;
3. The plist file can be loaded to the array using the &lt;i&gt;dictionaryWithContentOfFile&lt;/i&gt; or &lt;i&gt;arrayWithContentOfFile&lt;/i&gt; method. Typically it is loaded in the &lt;em&gt;viewDidLoad&lt;/em&gt; method&amp;nbsp;in the &lt;em&gt;UIViewController.&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Eg: For &lt;span style=&quot;color: red;&quot;&gt;NSDictionary&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;NSString *path = [[NSBundle mainBundle] pathForResource:@&quot;name&quot; ofType:@&quot;plist&quot;];&lt;br /&gt;
NSMutableDictionary *dictionary=[NSMutableDictionary dictionaryWithContentOfFile: path];&lt;br /&gt;
&lt;/div&gt;Eg: For &lt;span style=&quot;color: red;&quot;&gt;NSArray&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;NSString *path = [[NSBundle mainBundle] pathForResource:@&quot;name&quot; ofType:@&quot;plist&quot;];&lt;br /&gt;
NSMutableArray *arry=[NSMutableArray arrayWithContentOfFile: path];&lt;/div&gt;&lt;br /&gt;
4.&amp;nbsp;The &lt;em&gt;writeToFIle&lt;/em&gt; method can be used to write back changes to the plist for the array or dictionary object.&lt;br /&gt;
Eg: For &lt;span style=&quot;color: red;&quot;&gt;NSDictionary&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;[dictionary setVale:value forKey:@&quot;key&quot;];&lt;br /&gt;
[dictionary writeToFile: path automatically: YES];&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/8033866265524897630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/03/loading-nsarray-or-nsdictionary-with.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/8033866265524897630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/8033866265524897630'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2011/03/loading-nsarray-or-nsdictionary-with.html' title='Loading NSArray or NSDictionary with plist file'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-6773744108213997565</id><published>2010-08-16T23:24:00.000-07:00</published><updated>2011-03-20T06:01:18.380-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - Audio"/><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - Text To Speech"/><title type='text'>Text to speech using VSSpeechSynthesizer</title><content type='html'>The VSSpeechSynthesizer is the text to speech API in the private VoiceServices framework for IPhone OS 4.0. Appearently, it only available for IPhone 3GS or above. As the VoiceServices is not a public framework, application that is dependent on it may not be allow to publish to Apple appstore.&lt;br /&gt;
&lt;br /&gt;
It is quite a powerful API for text to speech, however it is not very well documented as it is in a private framework. To test out the API follow the following steps:&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;1. Create the VSSpeechSynthesizer.h file and&amp;nbsp;add it&amp;nbsp;into the project. &lt;/h3&gt;Code:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;em&gt;#import&amp;nbsp; &amp;lt;foundation/foundation.h&amp;gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;@interface VSSpeechSynthesizer : NSObject &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;{ &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;} &lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;+ (id)availableLanguageCodes; &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;+ (BOOL)isSystemSpeaking; &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;- (id)startSpeakingString:(id)string; &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;- (id)startSpeakingString:(id)string toURL:(id)url; &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;- (id)startSpeakingString:(id)string toURL:(id)url withLanguageCode:(id)code; &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;- (float)rate;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // default rate: 1 &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;- (id)setRate:(float)rate; &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;- (float)pitch;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // default pitch: 0.5&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;- (id)setPitch:(float)pitch; &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;- (float)volume;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // default volume: 0.8&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;- (id)setVolume:(float)volume; &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;@end&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;h3&gt;2. Create and initiate the VSSpeechSynthesizer object in the appropiate area of the code.&lt;/h3&gt;Code:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;VSSpeechSynthesizer *speech = [[NSClassFromString(@&quot;VSSpeechSynthesizer&quot;) alloc] init];&lt;/em&gt;&lt;/div&gt;&lt;h3&gt;3. Adjust the pitch, rate or volume accordingly.&lt;/h3&gt;Eg:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;[speech setRate:(float)1.0];&lt;/em&gt;&lt;/div&gt;&lt;h3&gt;4. Create the speech in the appropiate area of the code.&lt;/h3&gt;Eg:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;[speech startSpeakingString:@&quot;Hello world, how are you&quot;];&lt;/em&gt;&lt;/div&gt;&lt;h3&gt;5. Include the private VoiceServices into the frameworks&lt;/h3&gt;Eg:&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMaAkE7w62zFZGofcyBpzPQ_l9bP5MewHVeMtZvyoYWlKw7AVJT3tcq5ZA649EOGwsMJ1S243JcufwB9tM4rswI-uUjnFyBzWlVnHzqNrJvO5tqt2MLsqHRmzji22yJKzAdEppQZCExHA/s1600/bind.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; ox=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMaAkE7w62zFZGofcyBpzPQ_l9bP5MewHVeMtZvyoYWlKw7AVJT3tcq5ZA649EOGwsMJ1S243JcufwB9tM4rswI-uUjnFyBzWlVnHzqNrJvO5tqt2MLsqHRmzji22yJKzAdEppQZCExHA/s200/bind.jpg&quot; width=&quot;100&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
Depending on where you install the IPhone SDK, the location of the VoiceServices framework may varies. Usually the VoiceServices framework is in the following directory:&lt;br /&gt;
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk&lt;br /&gt;
/System/Library/PrivateFrameworks/VoiceServices.framework/VoiceServices&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: red; color: white;&quot;&gt;*Note: The VoiceServies framework only available in the iPhoneOS platform, hence it can only build and run on the actual iPhone device. It can not be run and test on the simulator.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;strong&gt;Sample code:&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;a href=&quot;http://docs.google.com/leaf?id=0B3CjtxTA36IqMTg3ODI4YzktNTIwZC00NzRjLWI2ZGYtYTBlOWQyZjBlNTZl&amp;amp;hl=en&amp;amp;authkey=CMyF_YMK&quot;&gt;Click here to download the sample iPhone project file&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/6773744108213997565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/08/text-to-speech-using.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/6773744108213997565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/6773744108213997565'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/08/text-to-speech-using.html' title='Text to speech using VSSpeechSynthesizer'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMaAkE7w62zFZGofcyBpzPQ_l9bP5MewHVeMtZvyoYWlKw7AVJT3tcq5ZA649EOGwsMJ1S243JcufwB9tM4rswI-uUjnFyBzWlVnHzqNrJvO5tqt2MLsqHRmzji22yJKzAdEppQZCExHA/s72-c/bind.jpg" height="72" width="72"/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-4245864311403448574</id><published>2010-08-06T11:00:00.000-07:00</published><updated>2011-03-20T06:02:33.869-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Auto show keyboard</title><content type='html'>To automatically show the keyboard in any view for a specific UITextField, just set the UITextField as the first responder in the viewDidLoad method.&lt;br /&gt;
&lt;br /&gt;
Eg:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - (void)viewDidLoad {&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [super viewDidLoad]; &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [commentTxt becomeFirstResponder];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;br /&gt;
&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/em&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/4245864311403448574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/08/auto-show-keyboard.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/4245864311403448574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/4245864311403448574'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/08/auto-show-keyboard.html' title='Auto show keyboard'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-4258723445468820582</id><published>2010-08-05T21:26:00.000-07:00</published><updated>2011-03-20T06:05:11.482-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Programming IPhone to support rotation auto orientation change</title><content type='html'>Everytime when IPhone is rotated the shouldAutorotateToInterfaceOrientation method is called.&lt;br /&gt;
To support this, just return YES. &lt;br /&gt;
&lt;br /&gt;
Eg:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Return YES for supported orientations &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return YES; &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;/em&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/4258723445468820582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/08/programming-iphone-to-support-rotation.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/4258723445468820582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/4258723445468820582'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/08/programming-iphone-to-support-rotation.html' title='Programming IPhone to support rotation auto orientation change'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-8231464974389795993</id><published>2010-06-11T10:47:00.000-07:00</published><updated>2011-03-20T06:00:17.288-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - Audio"/><title type='text'>Audio and Sound</title><content type='html'>&lt;strong&gt;&lt;span style=&quot;background-color: white; color: black;&quot;&gt;SystemSound API&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;For short sounds only, less than 5 sec&lt;/li&gt;
&lt;li&gt;for .caf .aif or .wav only&lt;/li&gt;
&lt;li&gt;No control and immediate playback&lt;/li&gt;
&lt;/ul&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Steps to coding&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1. Register the sound&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2. Play the sound&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3. Optionally can get call back when finished&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Eg:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NSURL *url =&amp;nbsp;[[NSBundle mainBundle] pathForResource: @&quot;audiofilename&quot; ofType: @&quot;ext&quot;];&amp;nbsp;&amp;nbsp; &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SystemSoundID id;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AudioServicesCreateSystemSoundID((CFURLRef)url, &amp;amp;id);&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AudioServicesPlaySystemSound(id);&amp;nbsp;&amp;nbsp; // to play the sound file&lt;/em&gt;&lt;/div&gt;&lt;br /&gt;
&lt;strong&gt;AVAudioPlayer Class&lt;/strong&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;High level simple&amp;nbsp;API for playing back long sound (&amp;gt;5sec)&lt;/li&gt;
&lt;li&gt;Support play, stop, loop, pause, seek&lt;/li&gt;
&lt;li&gt;Support many more sound formats&lt;/li&gt;
&lt;/ul&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Steps to coding&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Include the AVFoundation header into the .h file. Eg:&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #import &amp;lt;AVFoundation/AVFoundation.h&amp;gt;&lt;/em&gt;&lt;/div&gt;&lt;br /&gt;
Create AVAudioPlayer from file URL or data, Eg:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AVAudioPlayer *player;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NSString *path = [[NSBundle mainBundle] pathForResource: @&quot;audiofilename&quot; ofType: @&quot;ext&quot;];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NSURL *url = [NSURL fileURLWithPath: path];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error: NULL];&lt;/em&gt;&lt;/div&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Start or stop player as needed. Eg:&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if&amp;nbsp;&amp;nbsp; (!player.playing) {&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [player play];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} else {&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [player pause];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/em&gt; &lt;/div&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Add AVAudionFoundation Frameworks objects code&amp;nbsp;to the project. Eg:&lt;/li&gt;
&lt;/ul&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; In Xcode, under &lt;em&gt;Groups and file&lt;/em&gt; Section, Under &lt;em&gt;Frameworks&lt;/em&gt;, add&amp;nbsp;-&amp;gt; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Exsisting Frameworks. Select the AVaudioFoundation.framework to add to the&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Frameworks section.</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/8231464974389795993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/06/audio-and-sound.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/8231464974389795993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/8231464974389795993'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/06/audio-and-sound.html' title='Audio and Sound'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-4800084535476742700</id><published>2010-05-26T11:06:00.000-07:00</published><updated>2011-04-11T09:07:35.808-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Creating scrollable view</title><content type='html'>These are the steps for creating an application with scrollable view:&lt;br /&gt;
1. Create a scrollable view in the application&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;use either interface builder or code to add a UIScrollView to the current window&lt;/li&gt;
&lt;li&gt;Sample code to add a scroll view:&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CGRect frame = [CGRectMake(0,0,200,200)];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UIScrollView* scrollView = [[UIScrollView alloc] initWithFrame:frame];&lt;/em&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
2. Add subviews (frames may extend beyond the above scroll view bounds)&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Sample code to add subview:&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UIImage* image = [UIImage withName: @&quot;image.jpg&quot;];&amp;nbsp; /// image.jpg need to be added to resource&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UIImageView imageView = [[UIImageView alloc] initWithImage:image];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [scrollView addSubview: imageView];&lt;/em&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
3. Set the content size&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;sample code to set content size:&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;em&gt;[scrollView setContentSize: [image size]];&lt;/em&gt;&lt;/div&gt;&lt;br /&gt;
4. Set the max zoom and min zoom, if zoom is needed&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;sample code to set min and max zoom:&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;em&gt;&amp;nbsp; [scrollView setMaximumZoomScale: 4.0];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [scrollView setMinimumZoomScale: 0.1];&lt;/em&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
5. If zoom is needed, implement the ScrollView&#39;s&lt;span style=&quot;background-color: white;&quot;&gt; &lt;strong&gt;&lt;span style=&quot;color: red;&quot;&gt;viewForZoomingInScrollView&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&amp;nbsp;delegate&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;sample code for viewForZoomingInScrollView delegate:&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - (UIView *) viewForZoomingInScrollView: (UIScrollView *) scrollView&amp;nbsp; {&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return imageView;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/em&gt;&lt;/div&gt;6. Implement all the needed and optional delegate if neccessary.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Implement scrollViewDidScroll delegate if need to respond to scroll event&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;sample code:&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - (void) scrollViewDidScroll: (UIScrollView *)scrollView&amp;nbsp; {&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (scrollView.contentOffset ...) {&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/em&gt;&lt;em&gt;// do something here&lt;/em&gt;&lt;br /&gt;
&amp;nbsp;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/em&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Set the scrollViewShouldScrollToTop delegate to change the behaviour&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;sample code:&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- (BOOL) scrollViewShouldScrollToTop: (UIScrollView *) scrollView {&lt;/em&gt;&lt;br /&gt;
&amp;nbsp;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // return TRUE or FALSE, depending on view should scroll to top&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/em&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;7. When the view is no more needed, to allow user to return to previous view,&amp;nbsp;send the &lt;em&gt;removeFromSuperview&lt;/em&gt; message to the viewController. &lt;/div&gt;&lt;ul&gt;&lt;ul&gt;&lt;li&gt;sample code:&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;em&gt; [self.view removeFromSuperview];&lt;/em&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/4800084535476742700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/05/creating-scrollable-view.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/4800084535476742700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/4800084535476742700'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/05/creating-scrollable-view.html' title='Creating scrollable view'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-6328649764455295966</id><published>2010-05-22T10:53:00.000-07:00</published><updated>2011-03-20T06:05:39.805-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Creating application with UITabBarController</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPzazvE2-K8H3-9z7A5pP2N3IO8pLgjvAYdUR60GoRNPLlr77rKFfpHokNmvjQKjWE6FR9E0mTEUE8d-vt8RYXhYY6I2xNfyDDSXRDj65gIhlJjuUv1uyoKUANu1A-guajKEDkoKjYmsc/s1600/tabbarCtr.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; cssfloat: right; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; gu=&quot;true&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPzazvE2-K8H3-9z7A5pP2N3IO8pLgjvAYdUR60GoRNPLlr77rKFfpHokNmvjQKjWE6FR9E0mTEUE8d-vt8RYXhYY6I2xNfyDDSXRDj65gIhlJjuUv1uyoKUANu1A-guajKEDkoKjYmsc/s200/tabbarCtr.JPG&quot; width=&quot;163&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;/div&gt;The diagram shows the layout of a typical IPhone application. Each UI component name is also stated in the diagram. Usually an IPhone application has one UITabBarController. When the tab bar is selected, a specific NavigationController is activated. Each Navigation Controller can be pushed with one or more View Controller. Typically other View Controller can be&amp;nbsp;invoked by linking a button to the method that pop the view controller.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;The hierarchy of the UI component is shown in the diagram below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxexwHtsVUIvqtwxOY5ZvdoHK2Xm5jfAIDtIMDyXIQfvqWIhyphenhyphen92nOVsc80a174AkEhzoAKZnOeNbz9jFarrWibq4k-AtG2U_mGZtyRX87fu_ZOHzX6csfJ20L8OXAVNKlHxMwRCBYZsqw/s1600/UITabBarApp.jpg&quot; imageanchor=&quot;1&quot; style=&quot;cssfloat: left; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; gu=&quot;true&quot; height=&quot;321&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxexwHtsVUIvqtwxOY5ZvdoHK2Xm5jfAIDtIMDyXIQfvqWIhyphenhyphen92nOVsc80a174AkEhzoAKZnOeNbz9jFarrWibq4k-AtG2U_mGZtyRX87fu_ZOHzX6csfJ20L8OXAVNKlHxMwRCBYZsqw/s640/UITabBarApp.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;strong&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Nesting Navigation Controllers in UITabBarController&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Create&amp;nbsp;UITabBarController&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tabBarController =&amp;nbsp;&amp;nbsp;[[UITabBarController alloc] init];&lt;/em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Create each UINavigationController&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UINavigationController *navController1 = [[UINavigationController alloc] init];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [navController pushViewController: firstViewController animated: NO];&lt;/em&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // .....&amp;nbsp; create other UINavigationController&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Add all the UINavigationController / UIViewController to UITabBarController&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tabBarController.viewControllers = [NSArray arrayWithObjects:&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; navController1,&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; navController2,&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; otherViewController,&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nil ];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [window addSubView:tabBarController.view];&lt;/em&gt;&lt;/div&gt;The above code is typically add to applicationDelegate viewDidFinishLaunchingWithOptions method.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: left;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Customizing the UI controller&lt;/span&gt;&lt;/strong&gt; &lt;/div&gt;&lt;br /&gt;
The &lt;strong&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Title&lt;/span&gt;&lt;/strong&gt; on the UINavigationController can be customized by changing the viewController.title field in the viewDidLoad method in the view class. Eg:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;firstView.title = @&quot;First View&quot;;&amp;nbsp;&amp;nbsp; &lt;/em&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;The TabBarItem image and title can be customized by changing the tabBarItem field in navigationController or viewController. Eg: The customization code can be added to the viewDidLoad method of the viewController.&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&lt;ul&gt;&amp;nbsp;&amp;nbsp;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:@&quot;Playlists&quot;&lt;/em&gt; &lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; image: [UIImage imageNamed:@&quot;music.png&quot;] &lt;/em&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tag: 0];&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.tabBarItem = item;&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [item release];&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/div&gt;&lt;/ul&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;System item can also be added to the tab bar, Eg:&lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UITabBarItem *item = [[UITabBarItem alloc] initWithTabBarSystemItemItem:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;UITabBarSystemItemContacts tag:0];&lt;/em&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;navigationController.tabBarItem = item;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [item&amp;nbsp;release];&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/6328649764455295966/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/05/creating-application-with.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/6328649764455295966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/6328649764455295966'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/05/creating-application-with.html' title='Creating application with UITabBarController'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPzazvE2-K8H3-9z7A5pP2N3IO8pLgjvAYdUR60GoRNPLlr77rKFfpHokNmvjQKjWE6FR9E0mTEUE8d-vt8RYXhYY6I2xNfyDDSXRDj65gIhlJjuUv1uyoKUANu1A-guajKEDkoKjYmsc/s72-c/tabbarCtr.JPG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-3720264804102130132</id><published>2010-05-21T12:44:00.000-07:00</published><updated>2011-04-26T12:06:18.756-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Customizing UIBarButtonItem and UIToolbarItem on UINavigationController</title><content type='html'>There are a bar on the top of the application that has UINavigationController. This top&amp;nbsp;bar is typically&amp;nbsp;known as the&amp;nbsp;navigation bar, it can be customized with &lt;strong&gt;rightButtonItem&lt;/strong&gt;, &lt;strong&gt;leftButtonItem&lt;/strong&gt; and the &lt;strong&gt;title&lt;/strong&gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiXwz5l8SOXCShP-P7drIu5oGhygRxTbAW_YVAn2I-8VsprSp5V24kxx7hnL6eAwRGRbH-iK96FyU6FH6PbBYxSU3vi6oMveOmhUft_hHwgsMiMuDDmaD2TZLgYza0_kmaZGZ9xP0W_P0/s1600/navigation.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; gu=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiXwz5l8SOXCShP-P7drIu5oGhygRxTbAW_YVAn2I-8VsprSp5V24kxx7hnL6eAwRGRbH-iK96FyU6FH6PbBYxSU3vi6oMveOmhUft_hHwgsMiMuDDmaD2TZLgYza0_kmaZGZ9xP0W_P0/s320/navigation.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: left;&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;Th﻿e bottom bar in the UINavigationController is typically known as tool bar. It can be customized with &lt;em&gt;setToolbarItems &lt;/em&gt;using an array of &lt;em&gt;UIBarButtonItem.&lt;/em&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&amp;nbsp; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip1PGviuhWpzrAr77oXMOLaha02JD8KOL9uMFnEqQHRanwpqM4Shcub2IuEn-rx-ufI1VQUuxCwH_cfTjpQYdt1R7bGMQRiL9q8307NWGXzirYiVFYRqWjcuoAG3s7O7BE_P1yAbzQcoc/s1600/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-04-20-16-47-31.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; i8=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip1PGviuhWpzrAr77oXMOLaha02JD8KOL9uMFnEqQHRanwpqM4Shcub2IuEn-rx-ufI1VQUuxCwH_cfTjpQYdt1R7bGMQRiL9q8307NWGXzirYiVFYRqWjcuoAG3s7O7BE_P1yAbzQcoc/s1600/Mac+OS+X+Server+10.6+%2528experimental%2529-2011-04-20-16-47-31.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;The following outline the step to customize the navigation bar and tool bar buttons:&lt;br /&gt;
&lt;br /&gt;
1. Usually the best place to add the customization code for adding the &lt;em&gt;UINavigationBarItem&lt;/em&gt; and &lt;em&gt;UIToolBarItems&lt;/em&gt; is in the &lt;em&gt;viewDidLoad &lt;/em&gt;method of the &lt;em&gt;UIViewController.&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
2. To add the &lt;em&gt;UINavigationBarItem&lt;/em&gt;, &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; a)&amp;nbsp;First create an &lt;em&gt;UIBarButtonItem&lt;/em&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Eg: the below code implement&amp;nbsp;system button&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UIBarButtonItem *butt = [[UIBarButtonItem alloc]&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; initWithBarButtonSystemItem: UIBarButtonSystemItemCarmera&amp;nbsp;&amp;nbsp; &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; target:self action:@selector(action)];&lt;/em&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp; b)&amp;nbsp;Add the newly created custom button to the navigation bar:&lt;br /&gt;
&amp;nbsp;&amp;nbsp; Eg:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;self.navigationItem.rightBarButtonItem&amp;nbsp;= butt;&lt;/em&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Menlo-Regular; font-size: small;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// or [self.navigationItem setRightBarButtonItem:butt animated:YES];&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
3. If back button is needed in all subsequence pushed viewController (to return to parent view),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; the backBarButtonItem is needed to add to the root navigationController. If the title of the &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; backBarButtonItem is not set, the default behaviour is that the back button will be created with &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; the title of the parent view.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;**Note: For default behaviour to work, all the viewController must be set with a title.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Eg:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UIBarButtonItem *backButt = [[UIBarButtonItem alloc]init];&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[backButt setTitle:@&quot;Back&quot;];&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.navigationItem setBackBarButtonItem:backButt];&lt;/div&gt;&lt;br /&gt;
4. To add the UIToolbarItems,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; a) First create all the individual needed UIBarButtonItem&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Eg: Below code create the system&#39;s&amp;nbsp;action and compose button, and&amp;nbsp; a custom information button&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;background-color: red; color: white;&quot;&gt;Note: the custom information button does not work in the navigation bar&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;em&gt;&amp;nbsp;UIBarButtonItem *butt1 = [[UIBarButtonItem alloc]&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; initWithBarButtonSystemItem:UIBarButtonSystemItemAction&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;target:self action:@selector(getInfo:)];&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;UIBarButtonItem *butt2 = [[UIBarButtonItem alloc]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;initWithBarButtonSystemItem:UIBarButtonSystemItemCompose &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; target:self action:@selector(getInfo:)];&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* &lt;/em&gt;Below code create other system button, such as Info Button */&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UIButton* infoButton = [UIButton buttonWithType:UIButtonTypeInfoDark]; &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [infoButton addTarget:self action:@selector(action) &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; forControlEvents:UIControlEventTouchUpInside];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UIBarButtonItem *butt3 = [[UIBarButtonItem alloc] initWithCustomView: infoButton];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;/***&amp;nbsp; Below code add a button with image **/&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UIButton* starButt =[UIButton buttonWithType:UIButtonTypeCustom];&lt;/em&gt;&lt;br /&gt;
&amp;nbsp;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UIImage* buttonImage = [UIImage imageNamed:@&quot;star.png&quot;];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [starButt addTarget:self action:@selector(getInfo:)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;forControlEvents:UIControlEventTouchUpInside];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [starButt setImage:buttonImage forState:UIControlStateNormal];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; starButt.frame = CGRectMake(0, 0, buttonImage.size.width, buttonImage.size.height);&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;UIBarButtonItem *butt4 = [[UIBarButtonItem alloc]initWithCustomView:starButt];&lt;/em&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;b) Create an array for all the above created UIBarButtonItems.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eg.&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NSArray* toolBarItems = [NSArray arrayWithObjects:butt1,butt2,butt3,butt4,nil];&lt;/em&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c)&amp;nbsp; Release all the create UIBarButtonItems&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eg.&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [toolBarItems makeObjectsPerformSelector:@selector(release)];&lt;/em&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d)&amp;nbsp; Assign the newly created UIBarButtonItem array to the toolBarItems and set it to not hidden (&lt;span style=&quot;color: red;&quot;&gt;by &lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;default it is hidden&lt;/span&gt;) :&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eg.&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[self setToolbarItems:toolBarItems animated:YES]; // or self.toolbarItems = toolBarItems; &lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[self.navigationController setToolbarHidden:NO]; //or self.navigationController.toolbarHidden= NO;&lt;/em&gt;&lt;/div&gt;&lt;br /&gt;
5.&amp;nbsp;Implement the method to handle when the button is clicked.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; eg.&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;- (void)action {&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // ... actual code to implement the action&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // ... when the button is clicked&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;/em&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/3720264804102130132/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/05/customizing-uibarbutton-on.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/3720264804102130132'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/3720264804102130132'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/05/customizing-uibarbutton-on.html' title='Customizing UIBarButtonItem and UIToolbarItem on UINavigationController'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiXwz5l8SOXCShP-P7drIu5oGhygRxTbAW_YVAn2I-8VsprSp5V24kxx7hnL6eAwRGRbH-iK96FyU6FH6PbBYxSU3vi6oMveOmhUft_hHwgsMiMuDDmaD2TZLgYza0_kmaZGZ9xP0W_P0/s72-c/navigation.gif" height="72" width="72"/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-5240426887874807167</id><published>2010-05-19T00:28:00.000-07:00</published><updated>2011-04-20T21:23:14.259-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Data flow communication between UIViews</title><content type='html'>There are many ways for two UIViews to exchange data between them. Below list a few of them:&lt;br /&gt;
&lt;br /&gt;
1. Global variable&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; This is the&amp;nbsp;least desire way, though it is probably the easiest way. However, this way is most difficult to &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;maintain. With this, it is almost impossible to know which UIViews are related. When changes make to &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; one, it is also very difficult to assess which other will be impacted.&lt;br /&gt;
&lt;br /&gt;
2. Message passing&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Public variable can be setup in the UIViews. Setter method can be automatically generated by using the &lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @synchronize&lt;/strong&gt; keyword. The setter method can be invoke to pass the message. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Eg.&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;em&gt;UIView.title=@&quot;Testing&quot;;&lt;/em&gt;&lt;/div&gt;&lt;br /&gt;
3. Delegate&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Setup delegate interface in the UIView that will be call when there are event changes in the calling&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; UIView.</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/5240426887874807167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/05/data-flow-communication-between-uiviews.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/5240426887874807167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/5240426887874807167'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/05/data-flow-communication-between-uiviews.html' title='Data flow communication between UIViews'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-6721535673847176146</id><published>2010-05-15T22:22:00.000-07:00</published><updated>2011-04-26T11:46:18.766-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Creating an UINavigationController application</title><content type='html'>&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgD8MFnFQJnd0KsrOjnk2bP4TatC441VU0HVzAFu07mv7LdGpUXKVX2zO6dZEKkIT1gCg-MGGJ6Yayw1aGSk7NGQUhrNGa21XH0Kq36J75G9OVUxf1K5YyOISSN5-HXhFC_Hp3jF6ZQ9zs/s1600/window.GIF&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; cssfloat: right; float: right; height: 246px; margin-bottom: 1em; margin-left: 1em; width: 201px;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgD8MFnFQJnd0KsrOjnk2bP4TatC441VU0HVzAFu07mv7LdGpUXKVX2zO6dZEKkIT1gCg-MGGJ6Yayw1aGSk7NGQUhrNGa21XH0Kq36J75G9OVUxf1K5YyOISSN5-HXhFC_Hp3jF6ZQ9zs/s200/window.GIF&quot; width=&quot;198&quot; wt=&quot;true&quot; /&gt;&lt;/a&gt;A UINavigationController can be added to simple IPhone window application, to create a navigation bar on top of the view as shown in the diagram in the right. The following steps show how UINavigationController can be added to a simple IPhone window application: &lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;br /&gt;
1.&amp;nbsp; Add the UINavigationController object in the header file for the &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; applicationDelegate. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Eg. in &lt;strong&gt;ApplicationDelegate.h&lt;/strong&gt; @interface section:&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;em&gt;UINavigationControoller *uiNavCtrl;&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
2. Add the following codes to the &lt;strong&gt;applicationDelegate.m&lt;/strong&gt; main class in &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;the &lt;strong&gt;didFinishedLaunchingWithOptions&lt;/strong&gt; method. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Eg. &lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;em&gt;uiNavCtrl=[[UINavigationController alloc] init];&amp;nbsp;&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [window addSubView: uiNavCtrl.view];&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/em&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
3. After adding the above codes, UINavigationController has to be release in the &lt;strong&gt;dealloc&lt;/strong&gt; method in the &lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; applicationDelegate.m&lt;/strong&gt; main class.&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [uiNavCtrl&amp;nbsp;&amp;nbsp;&amp;nbsp; release];&lt;/em&gt;&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; An UINavigationController can have multiple UIViewControllers class &lt;strong&gt;pushed&lt;/strong&gt; into it. If more than one &lt;br /&gt;
&amp;nbsp;&amp;nbsp; UIViewController&amp;nbsp;are pushed into the UINavigationController, the last one that&amp;nbsp;is pushed will be &lt;br /&gt;
&amp;nbsp;&amp;nbsp; displayed, when the application&amp;nbsp;is first&amp;nbsp;launched. A &lt;strong&gt;Back&lt;/strong&gt; button will be automatically created if there are &lt;br /&gt;
&amp;nbsp;&amp;nbsp; more than one UIViewController class are pushed. Steps below outline how to add new &lt;br /&gt;
&amp;nbsp;&amp;nbsp; UIViewController to UINavigationController:&lt;br /&gt;
&lt;br /&gt;
4.&amp;nbsp;If back button&amp;nbsp;is needed in all subsequence pushed &lt;em&gt;viewController&lt;/em&gt; (to return to&amp;nbsp;parent view),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;the&amp;nbsp;&lt;em&gt;backBarButtonItem&lt;/em&gt; is needed to add to&amp;nbsp;the root navigationController. If the title of the &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;em&gt;backBarButtonItem &lt;/em&gt;is not&amp;nbsp;set, the default behaviour&amp;nbsp;is that&amp;nbsp;the&amp;nbsp;back button will be&amp;nbsp;created with &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; the title of the parent view.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;**Note: For default behaviour to work, all the viewController must be set with a title.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Eg:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UIBarButtonItem *backButt = [[UIBarButtonItem alloc]init];&lt;/em&gt;&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[backButt setTitle:@&quot;Back&quot;];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.navigationItem setBackBarButtonItem:backButt];&lt;/em&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9-RO5LmvW4i7SDvUiwW12saZgucpDlt-A9keCOplscrI4jonQe9_W1JiuXSPvAJGdVoRfnNINbFiTvcp2wbj9xIYhv9BYvju968iKULS8O1DIMT2k99Tr7JHGTo2YzATXnyJ8ErDImpk/s1600/Mac+OS+X+Server+10.6+(experimental)-2010-05-15-12-57-53.gif&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; cssfloat: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9-RO5LmvW4i7SDvUiwW12saZgucpDlt-A9keCOplscrI4jonQe9_W1JiuXSPvAJGdVoRfnNINbFiTvcp2wbj9xIYhv9BYvju968iKULS8O1DIMT2k99Tr7JHGTo2YzATXnyJ8ErDImpk/s320/Mac+OS+X+Server+10.6+(experimental)-2010-05-15-12-57-53.gif&quot; wt=&quot;true&quot; /&gt;&lt;/a&gt;&lt;/div&gt;5. Create a new UIViewController sub-class. &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; a) In XCode, under &lt;strong&gt;Groups &amp;amp; Files, &lt;/strong&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; expan&lt;strong&gt;d &lt;/strong&gt;current project.&amp;nbsp;Higfhlight &lt;strong&gt;Class,&lt;/strong&gt; right &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; click &lt;strong&gt;Add-&amp;gt;New File...&lt;/strong&gt; Refer to the &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; diagram in the left.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A new file selection menu will be poped up.&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe3OOJTyCVRj0VYWKPowZHiRIEUBRIZbtvqg6j-RqGT4Qsiuk84A0EMbjlF9DobLWAswbb6u3KLcgaseV9qi4qQjjeGhqV1azUPTBE5Cvxub9ld7WVjk16r3ogwJ6dqmUYNWIF3wXMgyg/s1600/Mac+OS+X+Server+10.6+(experimental)-2010-05-15-12-58-51.gif&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; cssfloat: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;161&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe3OOJTyCVRj0VYWKPowZHiRIEUBRIZbtvqg6j-RqGT4Qsiuk84A0EMbjlF9DobLWAswbb6u3KLcgaseV9qi4qQjjeGhqV1azUPTBE5Cvxub9ld7WVjk16r3ogwJ6dqmUYNWIF3wXMgyg/s200/Mac+OS+X+Server+10.6+(experimental)-2010-05-15-12-58-51.gif&quot; width=&quot;200&quot; wt=&quot;true&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp; b)&amp;nbsp;In the new File windows, select &lt;strong&gt;UIViewController&lt;/strong&gt; sub-class. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Also select &lt;strong&gt;with XIB for users interface&lt;/strong&gt; option.&amp;nbsp;This option &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; will&amp;nbsp;generate the XIB file automatically. This XIB is to be used in&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the interface builder, to simplify the creation of visual control in the &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UIView. If this option is not selected, the XIB file has to be created &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; manually&amp;nbsp;later after the class file is generated. This option will &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; save&amp;nbsp;two steps of manual work to create the XIB file.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;After that click on the &lt;strong&gt;Next &lt;/strong&gt;button, to proceed to next step of the &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;class generation.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdHb4O-ahpW5Pkz03p0FijiK8UgnP0lygcDGRoUpEeqMc9IHCmJyi-lXw5U92qcO-LcNZ_J808f6inHHwhr4Kf5AzLaocsKPOBlqoEpcBb3EuX8M8bvujGXrSaF8RDA0OY2EIfDiXbERg/s1600/Mac+OS+X+Server+10.6+(experimental)-2010-05-18-13-58-19.gif&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; cssfloat: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdHb4O-ahpW5Pkz03p0FijiK8UgnP0lygcDGRoUpEeqMc9IHCmJyi-lXw5U92qcO-LcNZ_J808f6inHHwhr4Kf5AzLaocsKPOBlqoEpcBb3EuX8M8bvujGXrSaF8RDA0OY2EIfDiXbERg/s200/Mac+OS+X+Server+10.6+(experimental)-2010-05-18-13-58-19.gif&quot; width=&quot;200&quot; wt=&quot;true&quot; /&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;c) In the following new File window, specify the name for the &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UIViewController sub-class that to be created. After that click the &lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; finish&lt;/strong&gt; button to generate the class, header and XIB files. &lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Note: As part of the programming convension the class name &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; typically start with uppercase character and follow with lowercase&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; characters.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Uppercase first&amp;nbsp;character is also usually used for all the following &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;words in the class name. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Eg. &lt;strong&gt;FirstView&lt;/strong&gt;&amp;nbsp;, &lt;strong&gt;SecondView&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;br /&gt;
6. Once the UIViewController sub-class is&amp;nbsp;being generated, the view can be customized according to &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; the&amp;nbsp;requirement in the interface builder by clicking the newly created&amp;nbsp;XIB file. The UI control (eg. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; UISlider,&amp;nbsp;UIButton, UILabel... etc) can be added to the view in interface builder. &lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;7. To use the newly created UIViewController in the&amp;nbsp;window application, it has to be pushed&amp;nbsp;to the &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; UINavigationController. The best way is to push through the &lt;strong&gt;didFinishedLaunchingWithOptions&lt;/strong&gt; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; method in the applicationDelegate.m main class. &amp;nbsp;Eg: add the following code to&lt;strong&gt; &lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; didFinishedLaunchingWithOptions&lt;/strong&gt; in &lt;strong&gt;ApplicationDelegate.m,&lt;/strong&gt; assume that FirstView is newly &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; created UIViewController:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FirstView *fv = [[UIViewController alloc] init];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fv.title = @&quot;Title&quot;;&amp;nbsp; // To add a title to the UIViewController&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [uiNavCtrl&amp;nbsp;&amp;nbsp;&amp;nbsp; pushViewController: fv animated: NO]; &lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [fv&amp;nbsp; release];&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *Note: If the animated option is set to YES, the UIView will be shown in a animated way. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Typically,&amp;nbsp;if it is&amp;nbsp;push through the didFinishedLaunchingWithOptions method, the animation will not show. &lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;8.&amp;nbsp;The newly created UIViewController can also be pushed through any UI controller such as UIButton ... &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; etc. IBAction method can be used to push the UIViewController. Eg. The following code show how this &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; can be done:&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a)&amp;nbsp;Add IBAction in the FirstView.h&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;em&gt;-(IBAction) getSecondView: (id) sender;&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; b) Add IBAction in the FirstView.m in the @interface section:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-(IBAction) getSecondView: (id) sender&amp;nbsp; {&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SecondView *sv = [[SecondView&amp;nbsp;&amp;nbsp; alloc] init];&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.navigationController&amp;nbsp;&amp;nbsp; pushViewController: sv animated: YES];&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [sv release];&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/em&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; c) Link the UI component change event to the above&amp;nbsp;created IBAction.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/6721535673847176146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/05/adding-uinavigationcontroller.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/6721535673847176146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/6721535673847176146'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/05/adding-uinavigationcontroller.html' title='Creating an UINavigationController application'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgD8MFnFQJnd0KsrOjnk2bP4TatC441VU0HVzAFu07mv7LdGpUXKVX2zO6dZEKkIT1gCg-MGGJ6Yayw1aGSk7NGQUhrNGa21XH0Kq36J75G9OVUxf1K5YyOISSN5-HXhFC_Hp3jF6ZQ9zs/s72-c/window.GIF" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-1509879982681483213</id><published>2010-04-01T09:53:00.000-07:00</published><updated>2011-04-20T22:52:45.564-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Modifying default UITextField behaviour - Iphone development</title><content type='html'>1. Create a cancel button in UITextField.&lt;br /&gt;
By default, the cancel button is disable when a new UITextField control is added to view. The button can be enabled by changing the&amp;nbsp;option for &lt;span style=&quot;background-color: yellow; color: red;&quot;&gt;Clear Button&lt;/span&gt;&amp;nbsp;of the UITextField property.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtU1A0j5QjENNCZHqFT6ZMLdk44L2sjg5cNCLH_szqle_oNuVXxHcqIvJ4Dl7AzzcRxAVEgFIYylvfpFj57lwOFQ64VNkI9PDUgtJAB-mYn-tpRtr33GkxSx8VlAJjjJ5eoegaaxBFwpE/s1600/iphone-cancelled-button.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; nt=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtU1A0j5QjENNCZHqFT6ZMLdk44L2sjg5cNCLH_szqle_oNuVXxHcqIvJ4Dl7AzzcRxAVEgFIYylvfpFj57lwOFQ64VNkI9PDUgtJAB-mYn-tpRtr33GkxSx8VlAJjjJ5eoegaaxBFwpE/s640/iphone-cancelled-button.jpg&quot; width=&quot;339&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Eg.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF7V2TdUr5BRM4zoFssWseFBWTyCRT-gmYMSdjl84IeEDfaUrs2bAN0MXHAUGDgRnP9mPGJwLGQw2J1cwESKg5peF5W9WoRWuDW0bDng22CX6OaAz3eh29n7KqE_d_1zyRIY1mXxy4vAQ/s1600/clear-button-option.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;483&quot; nt=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF7V2TdUr5BRM4zoFssWseFBWTyCRT-gmYMSdjl84IeEDfaUrs2bAN0MXHAUGDgRnP9mPGJwLGQw2J1cwESKg5peF5W9WoRWuDW0bDng22CX6OaAz3eh29n7KqE_d_1zyRIY1mXxy4vAQ/s640/clear-button-option.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
2. Disable the clearing old text in UITextField editing.&lt;br /&gt;
By default, when text is input to the UITextField, any previous entered text will be cleared. This can be disabled by unchecking the &lt;span style=&quot;background-color: yellow; color: red;&quot;&gt;clear when editing begins&lt;/span&gt;&amp;nbsp;option.&lt;br /&gt;
Eg.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKYJitRyVZ5QA-9FeulHzd74mY3fDKTM5W1R2nYesjX4Jghgv06Zis2GApv54jqePZdO9M3yAU1EVWwEymDPxchGyH5euxaZ-rCo9ssVQ2_JxmrA1OOb6l-eCVJTWoCQ577ScYmvi5oMQ/s1600/cleartextField.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;524&quot; nt=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKYJitRyVZ5QA-9FeulHzd74mY3fDKTM5W1R2nYesjX4Jghgv06Zis2GApv54jqePZdO9M3yAU1EVWwEymDPxchGyH5euxaZ-rCo9ssVQ2_JxmrA1OOb6l-eCVJTWoCQ577ScYmvi5oMQ/s640/cleartextField.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/1509879982681483213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/04/modifying-default-uitextfield-behaviour.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/1509879982681483213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/1509879982681483213'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/04/modifying-default-uitextfield-behaviour.html' title='Modifying default UITextField behaviour - Iphone development'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtU1A0j5QjENNCZHqFT6ZMLdk44L2sjg5cNCLH_szqle_oNuVXxHcqIvJ4Dl7AzzcRxAVEgFIYylvfpFj57lwOFQ64VNkI9PDUgtJAB-mYn-tpRtr33GkxSx8VlAJjjJ5eoegaaxBFwpE/s72-c/iphone-cancelled-button.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-184784829155397741</id><published>2010-04-01T03:45:00.000-07:00</published><updated>2011-04-20T22:50:31.609-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Dismiss IPhone keyboard in text field control</title><content type='html'>By default, IPhone keyboard will not dismiss automatically after user click on the done button or touch other control or view. IPhone developer has to code this behaviour into the control.&lt;br /&gt;
&lt;br /&gt;
The IPhone keyboard will only be dismissed after&amp;nbsp;a &lt;span style=&quot;color: red;&quot;&gt;&lt;strong&gt;&lt;em&gt;resignFirstResponder&lt;/em&gt; &lt;/strong&gt;&lt;/span&gt;message is&amp;nbsp;send to the control. &lt;br /&gt;
Eg.&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;em&gt; [textField resignFirstResponder];&lt;/em&gt;&lt;/div&gt;&lt;br /&gt;
There are probably many ways to add this message to the viewController code.&amp;nbsp; Below show two of them:&lt;br /&gt;
&lt;br /&gt;
1.&amp;nbsp;Implement&amp;nbsp; the textFieldShouldReturn delegate for the UITextField. Iphone will pass a message to textFieldShouldReturn method when the keyboard&#39;s done button is pressed. Call the send the resignFirstResponder message to the active&amp;nbsp;UITextField will dismiss the keyboard. The following section outline the steps to accomplish this:&lt;br /&gt;
&lt;br /&gt;
a)&amp;nbsp;&amp;nbsp;Add &lt;uitextfielddelegate&gt;to the viewController.h interface file to specify that it will implement the delegate textFieldShouldReturn method.&lt;br /&gt;
Eg. &lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;@interface sampleViewController : UIViewController&lt;/em&gt;&lt;em&gt;&amp;nbsp;&lt;uitextfielddelegate&gt;&amp;nbsp;&lt;/em&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;em&gt;&amp;lt;&lt;span style=&quot;color: red;&quot;&gt;UITextFieldDelegate&lt;/span&gt;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;//&lt;/em&gt; &lt;em&gt;add this line to&amp;nbsp;implement &lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;em&gt;textFieldShouldReturn method, when more than one use comma&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
b) Implement the textFieldShouldReturn method in the .m implement file.&lt;br /&gt;
Eg. &lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;-(BOOL)textFieldShouldReturn:(UITextField *)thisTextField&amp;nbsp; {&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [thisTextField resignFirstResponder];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // add code to process the input if needed&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return TRUE;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;}&lt;/em&gt;&lt;/div&gt;&lt;br /&gt;
c) link the textField to the class that implement the method.&lt;br /&gt;
Eg.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEictmAaibudk96WTJb86v4qGDMoa1yIMa-k28UCzk_oh_8ymvgRBMYXytFz3O6Zo24Tg1ewWZjJYlSQ4Chm76oU_OElRy87XPCW2D9-0B60rzF1VI2VhIoU34eDCH2HrdaCewi5GbJn_U0/s1600/bind-textFieldDelegate.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;478&quot; nt=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEictmAaibudk96WTJb86v4qGDMoa1yIMa-k28UCzk_oh_8ymvgRBMYXytFz3O6Zo24Tg1ewWZjJYlSQ4Chm76oU_OElRy87XPCW2D9-0B60rzF1VI2VhIoU34eDCH2HrdaCewi5GbJn_U0/s640/bind-textFieldDelegate.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
2. Override the touchesBegan method. Iphone will send the touchesBegan message when the view is being touched. In the overrided touchesBegan method, send the resignFirstResponder message to the active UITextField will dismiss the keyboard. &lt;br /&gt;
Example add the following code to the viewController:&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;&lt;em&gt;- (void)touchesBegan:(NSSet *)touches withEvent: (UIEvent *)event {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; if( textField.editing) {&amp;nbsp;&amp;nbsp; // UITextField.editing will return true if it is in the editing mode&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [textField resignFirstResponder];&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [super touchesBegan:touches withEvent:event];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // call the default touchesBegan method&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;}&lt;/em&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/184784829155397741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/04/controlling-keyboard-in-text-field.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/184784829155397741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/184784829155397741'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/04/controlling-keyboard-in-text-field.html' title='Dismiss IPhone keyboard in text field control'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEictmAaibudk96WTJb86v4qGDMoa1yIMa-k28UCzk_oh_8ymvgRBMYXytFz3O6Zo24Tg1ewWZjJYlSQ4Chm76oU_OElRy87XPCW2D9-0B60rzF1VI2VhIoU34eDCH2HrdaCewi5GbJn_U0/s72-c/bind-textFieldDelegate.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6419346046988748393.post-7065231788132130801</id><published>2010-04-01T03:24:00.000-07:00</published><updated>2011-04-20T23:09:17.038-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone - development - UI"/><title type='text'>Create a new control - IPhone development</title><content type='html'>1. Create control in&amp;nbsp;view using Interface Builder&#39;s Liberary. As shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnuD7CPefWfbMEpFaufY4tuVVnXKCTe3betJcj9AC0nA4DF1TN538ulmUg-xVkoG6LQ5E4PAAN3_3q6Rxx0PXOYA4GSIR1NbNNSSn3Kt0BsXCaaU2AJvD_llxMqO8YubjLtnMdY37T4Lk/s1600/control.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; nt=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnuD7CPefWfbMEpFaufY4tuVVnXKCTe3betJcj9AC0nA4DF1TN538ulmUg-xVkoG6LQ5E4PAAN3_3q6Rxx0PXOYA4GSIR1NbNNSSn3Kt0BsXCaaU2AJvD_llxMqO8YubjLtnMdY37T4Lk/s640/control.jpg&quot; width=&quot;636&quot; /&gt;&lt;/a&gt;&lt;/div&gt;2. Create outlet in view controller code.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;In the .h file, define the outlet for the control, example:&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;em&gt;IBOutlet UITextField *textField;&lt;/em&gt;&amp;nbsp;&amp;nbsp; // add this to the @interface section&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;em&gt;@property (nonautomic,retain) UITextField *textField;&amp;nbsp;&lt;/em&gt;&amp;nbsp; // add this outside of the @interface section&lt;/div&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;In the .m code, example:&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;code&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;em&gt;@synthesize textField;&lt;/em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //add this into the .m code after the @implement line&lt;/div&gt;&lt;br /&gt;
3. Link the control in Interface Builder view, to the&amp;nbsp;defined Outlet variable. Example:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMzg0XbKcV_Nx0yK-LTq_K84_GdHKHcVYs35P_licUExD60KMn9uZN1u8v4ssAxZlmeK1Gxkp3v2oVnfk32hkEydSD0f2_X5kr0AakvF8uMP6SlWZR1syAmlNdfziA1AoXvVEJI3NV7Yo/s1600/bind.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;420&quot; nt=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMzg0XbKcV_Nx0yK-LTq_K84_GdHKHcVYs35P_licUExD60KMn9uZN1u8v4ssAxZlmeK1Gxkp3v2oVnfk32hkEydSD0f2_X5kr0AakvF8uMP6SlWZR1syAmlNdfziA1AoXvVEJI3NV7Yo/s640/bind.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;4. Now the control, can be used in the code. &lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Eg:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;em&gt;textField.text = @&quot;hello world&quot;;&lt;/em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // to assign hello world to the text field&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;5. As the textField&amp;nbsp;variable is defined as retain in the .h file, it need to be manually released in the dealloc &lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; method. &lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Eg:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;em&gt;- (void) dealloc&amp;nbsp; {&lt;/em&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;[textField release];&lt;/span&gt;&lt;/em&gt;&amp;nbsp;&amp;nbsp; // add this line to manually relase the textField variable&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp; [super dealloc];&lt;/em&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;em&gt;}&lt;/em&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphone-dev-kitchan.blogspot.com/feeds/7065231788132130801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/04/create-new-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/7065231788132130801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6419346046988748393/posts/default/7065231788132130801'/><link rel='alternate' type='text/html' href='http://iphone-dev-kitchan.blogspot.com/2010/04/create-new-control.html' title='Create a new control - IPhone development'/><author><name>kitchan</name><uri>http://www.blogger.com/profile/03265427772500202744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnuD7CPefWfbMEpFaufY4tuVVnXKCTe3betJcj9AC0nA4DF1TN538ulmUg-xVkoG6LQ5E4PAAN3_3q6Rxx0PXOYA4GSIR1NbNNSSn3Kt0BsXCaaU2AJvD_llxMqO8YubjLtnMdY37T4Lk/s72-c/control.jpg" height="72" width="72"/><thr:total>0</thr:total></entry></feed>