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

<channel>
	<title>[iPhoneDev central]; &#187; IDC</title>
	<atom:link href="http://www.iphonedevcentral.com/category/idc/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.iphonedevcentral.com</link>
	<description></description>
	<lastBuildDate>Fri, 03 Dec 2010 14:23:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CNET Reviews iPhone App</title>
		<link>http://www.iphonedevcentral.com/cnet-reviews-iphone-app/</link>
		<comments>http://www.iphonedevcentral.com/cnet-reviews-iphone-app/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 14:17:33 +0000</pubDate>
		<dc:creator>Vladimir Olexa</dc:creator>
				<category><![CDATA[IDC]]></category>

		<guid isPermaLink="false">http://www.iphonedevcentral.com/?p=183</guid>
		<description><![CDATA[
I have been a bit slow updating this site lately partly because we were trying to launch our new app before the holiday season. It features CNET Reviews and packs a bag of goodies like easy category access, filtering and sorting results, latest pricing comparisons, search, barcode scanning or buying guides. So go check it out, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://itunes.apple.com/us/app/cnet-product-reviews/id399322513" onclick="urchinTracker('/outgoing/itunes.apple.com/us/app/cnet-product-reviews/id399322513?referer=');"><img class="alignnone" title="CNET Reviews iPhone App" src="http://i.i.com.com/cnwk.1d/i/tim/2010/11/02/CNET_Reviews_App_SS1_270x405.PNG" alt="" width="270" height="405" /></a></p>
<p>I have been a bit slow updating this site lately partly because we were trying to launch our new app before the holiday season. It features CNET Reviews and packs a bag of goodies like easy category access, filtering and sorting results, latest pricing comparisons, search, barcode scanning or buying guides. So go check it out, install it, and love it! <img src='http://www.iphonedevcentral.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Here is an intro blog post from a CNET executive editor: <a href="http://reviews.cnet.com/8301-19512_7-20021529-233.html" target="_blank" onclick="urchinTracker('/outgoing/reviews.cnet.com/8301-19512_7-20021529-233.html?referer=');">http://reviews.cnet.com/8301-19512_7-20021529-233.html</a></p>
<p>You can download the app here: <a href="http://reviews.cnet.com/iphoneappdownload" onclick="urchinTracker('/outgoing/reviews.cnet.com/iphoneappdownload?referer=');">http://reviews.cnet.com/iphoneappdownload</a> or directly from iTunes: <a href="http://itunes.apple.com/us/app/cnet-product-reviews/id399322513" target="_blank" onclick="urchinTracker('/outgoing/itunes.apple.com/us/app/cnet-product-reviews/id399322513?referer=');">http://itunes.apple.com/us/app/cnet-product-reviews/id399322513</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonedevcentral.com/cnet-reviews-iphone-app/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Apple WWDC 2010</title>
		<link>http://www.iphonedevcentral.com/applewwdc-2010/</link>
		<comments>http://www.iphonedevcentral.com/applewwdc-2010/#comments</comments>
		<pubDate>Fri, 28 May 2010 00:54:09 +0000</pubDate>
		<dc:creator>Vladimir Olexa</dc:creator>
				<category><![CDATA[IDC]]></category>

		<guid isPermaLink="false">http://www.iphonedevcentral.com/?p=178</guid>
		<description><![CDATA[Sold out in 8 eight days this year, WWDC will be held at its usual spot in  San Francisco from June 7 &#8211; 11. This year seems to put focus on the iPhone SDK more so than previous years. 
If it&#8217;s anything like last year, it&#8217;s going to be pretty miserable. 5,000 knowledge-hungry developers [...]]]></description>
			<content:encoded><![CDATA[<p>Sold out in 8 eight days this year, <a href="http://developer.apple.com/wwdc" target="_blank" onclick="urchinTracker('/outgoing/developer.apple.com/wwdc?referer=');">WWDC</a> will be held at its usual spot in  San Francisco from June 7 &#8211; 11. This year seems to put focus on the iPhone SDK more so than previous years. </p>
<p>If it&#8217;s anything like last year, it&#8217;s going to be pretty miserable. 5,000 knowledge-hungry developers from all around the world trying to get to the same sessions as you. There will be lines for everything; bathrooms, presentation rooms, lunch, labs, store, escalators. Pretty much anywhere you want go, there will hundreds of others who want the same thing. </p>
<p>At the end, it&#8217;s worth it though. The information presented is very solid. They don&#8217;t cover everything but enough to get you started. After you walk out of there, you should be able to build a semi-complex iPhone/iPad app. Not bad for ~4 days of sessions. </p>
<p>For all you first-comers, here are a few words of advice:</p>
<ol>
<li>If you want to see the keynote, count on seeing some hardcore fans camped out in front of Moscone as early as 1-2am. Getting there at 6am will put you somewhere at the end of the North-West side of Moscone West. You will still be able to get inside the keynote room at that point. Once people condense, the line isn&#8217;t really as long as it seems at first. I&#8217;d pack light, bring snacks and something small to sit on. You will get cold after a while no matter what the predictions say so have a jacket ready.
</li>
<li>There will be a bunch of companies going around the long line giving away SWAG. Don&#8217;t take anything you don&#8217;t want because you&#8217;ll have to hold it until you get to a trash can. The cute girls giving it away and trying to sign you up for their newsletter aren&#8217;t really interested in you, no matter how convincing they are. So don&#8217;t be gullible and be strong! <img src='http://www.iphonedevcentral.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </li>
<li>Once the line starts moving, don&#8217;t get your hopes up just yet. You&#8217;ll make several stops inside the building before reaching the presentation room. The good thing is, once you&#8217;re deep enough, Apple will provide breakfast pastries, coffee and water. Don&#8217;t run to it, there will be plenty of it. </li>
<li>The session rooms will fill up rather quickly. Always know what session you want to attend next and where it is. If you screw around for too long, you may not get in. </li>
<li>It&#8217;s easy to forget about the lunchtime speakers. Don&#8217;t waste your time pretending you&#8217;re coding in one of the rest areas and go see the lunchtime speakers. They&#8217;re really worth seeing. Their success stories are very inspiring and educational.</li>
<li>When it&#8217;s time for lunch, you don&#8217;t have to rush. There is plenty of food and lines are fairly manageable. It&#8217;s much better than lines to bathrooms or sessions. The food is made for masses so don&#8217;t expect Hubert Keller&#8217;s cuisine. A vegetarian dish will always be available so meat-haters need not worry. </li>
<li>For all of our sake, please do not type during sessions. Both slides and session videos will become available a couple months after the conference so don&#8217;t try to copy all the source code you see on the screen. There is a lot of loud typers out there and there really isn&#8217;t anything more annoying then listing someone hammering on their keyboard during a presentation. If a session bores you or you just prefer to IM your buddies instead, please leave the room so that someone who is actually interested can attend. </li>
<li>Evening events are fun. I&#8217;m not going to go as far as saying they&#8217;re unforgettable but they&#8217;re fun. Again, it used to be a lot more intimate a few years back but now that everything is being catered to five thousand people, it&#8217;s not the same. <em>Stump the experts</em> is one of those events that is highly hyped. It&#8217;s full of inside jokes that date all the way back to when WWDC was still in diapers. You may not laugh at them but it&#8217;s very intriguing to learn some of the &#8220;behind the scenes&#8221; tidbits you wouldn&#8217;t hear anywhere else. The prizes have been quite substantial too so if you happen to answer a difficult question, you may walk out of there with a Macbook Pro. </li>
<li>In general, don&#8217;t bring too much with you. You&#8217;ll have to carry it around all day long and that&#8217;s not fun. The bags and laptop sleeves Apple gives out when you pick up your badge are usually pretty uncomfortable to carry so don&#8217;t feel obligated to use them throughout the conference. My bag from last year is still in its plastic cover, untouched. It wanted to be a backpack but it was really a glorified laptop sleeve. Don&#8217;t expect to get two free phones like at Google IO.</li>
</ol>
<p>Among other conferences, like JavaOne, WWDC rates as one of the most exciting ones. The whole thing is designed as any other Apple product &#8211; very pretty to look at but it has its share of problems. There was a controversy going on about the cost of admission this year. There was no pre-registration period since Apple knew they would sell out quickly anyway. The price tag of $1,595 is up there but still cheap compared to other conferences. Only, the &#8220;other&#8221; conferences are usually paid for employers. WWDC attendees are mostly individual contributors who pay for the ticket out of their pockets. Therefore, $1,600 in addition to transportation, room and board for 5 days can be quite an expense. </p>
<p>For those attending, you&#8217;re going to have lots of fun and I hope to meet some of you there!  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonedevcentral.com/applewwdc-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FutureTap and Edovia release an In-app Settings Framework</title>
		<link>http://www.iphonedevcentral.com/futuretap-edovia-release-in-app-settings-framework/</link>
		<comments>http://www.iphonedevcentral.com/futuretap-edovia-release-in-app-settings-framework/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 19:47:01 +0000</pubDate>
		<dc:creator>Vladimir Olexa</dc:creator>
				<category><![CDATA[IDC]]></category>

		<guid isPermaLink="false">http://www.iphonedevcentral.com/?p=141</guid>
		<description><![CDATA[FutureTap and Edovia have released an open-source framework that gives developers the ability to offer app settings inside the app as opposed to having it only in Settings.app.
The way settings are used today is by specifying Settings.bundle and Root.plist files in your project. This lets Settings.app know about your app and its settings. The obvious [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://futuretap.com" target="_blank" onclick="urchinTracker('/outgoing/futuretap.com?referer=');">FutureTap</a> and <a href="http://edovia.com" target="_blank" onclick="urchinTracker('/outgoing/edovia.com?referer=');">Edovia</a> have released an open-source framework that gives developers the ability to offer app settings inside the app as opposed to having it only in Settings.app.</p>
<p>The way settings are used today is by specifying Settings.bundle and Root.plist files in your project. This lets Settings.app know about your app and its settings. The obvious downside of this approach is that app settings are separated from the app itself.</p>
<p><a href="http://inappsettingskit.com/" target="_blank" onclick="urchinTracker('/outgoing/inappsettingskit.com/?referer=');">InAppSettingsKit</a> uses a hybrid approach to this problem. It still uses the same resource files to create your settings bundle. However, your settings will be available both within the app and in Settings.app. This is great because you don&#8217;t have to create any additional metadata files to support this feature while still maintaining the existing functionality.</p>
<p>I&#8217;ll play around with it a bit and post back with a report. For now, head over to <a href="http://www.futuretap.com/blog/inappsettingskit" target="_blank" onclick="urchinTracker('/outgoing/www.futuretap.com/blog/inappsettingskit?referer=');">FutureTap&#8217;s</a> or <a href="http://www.edovia.com/blog/inappsettingskit" target="_blank" onclick="urchinTracker('/outgoing/www.edovia.com/blog/inappsettingskit?referer=');">Edovia&#8217;s</a> blogs for release notes and more information.</p>
<p><img class="alignleft" title="InAppSettingsKit" src="http://inappsettingskit.com/app/images/settings_example.png" alt="" width="319" height="531" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonedevcentral.com/futuretap-edovia-release-in-app-settings-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Tech Talk</title>
		<link>http://www.iphonedevcentral.com/iphone-tech-talk/</link>
		<comments>http://www.iphonedevcentral.com/iphone-tech-talk/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 22:42:40 +0000</pubDate>
		<dc:creator>Vladimir Olexa</dc:creator>
				<category><![CDATA[IDC]]></category>
		<category><![CDATA[ciui]]></category>
		<category><![CDATA[cnet]]></category>
		<category><![CDATA[iphone tech talk]]></category>

		<guid isPermaLink="false">http://www.iphonedevcentral.com/?p=139</guid>
		<description><![CDATA[I will be attending an iPhone Tech Talk this Thursday in San Jose. It&#8217;s going to be my third one so I wonder if the structure has changed. These talks are usually like mini-WWDCs &#8211; packed with information-rich sessions and a party at the end. Last year&#8217;s event was a mixture of different WWDC sessions [...]]]></description>
			<content:encoded><![CDATA[<p>I will be attending an iPhone Tech Talk this Thursday in San Jose. It&#8217;s going to be my third one so I wonder if the structure has changed. These talks are usually like mini-WWDCs &#8211; packed with information-rich sessions and a party at the end. Last year&#8217;s event was a mixture of different WWDC sessions from that year&#8217;s conference so I expect something similar this year as well.</p>
<p>The first one of these back in 2007 was still pre-SDK.  It was primarily concentrated around web-based apps. This is when I developed <a href="http://code.google.com/p/ciui-dev/" target="_blank" onclick="urchinTracker('/outgoing/code.google.com/p/ciui-dev/?referer=');">CiUI</a> to serialize production of web-based apps. <a href="http://www.cnet.com" target="_blank" onclick="urchinTracker('/outgoing/www.cnet.com?referer=');">CNET</a> is still using it (<a href="http://reviews.cnet.com/4250-1-0.html" target="_blank" onclick="urchinTracker('/outgoing/reviews.cnet.com/4250-1-0.html?referer=');">http://reviews.cnet.com/4250-1-0.html</a>) but development of their mobile sites has since been handed over to CBS Mobile.</p>
<p>In any case, if any of you are going to be in attendance this Thursday, hope you come say Hi!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonedevcentral.com/iphone-tech-talk/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Create a UITabBarController from scratch</title>
		<link>http://www.iphonedevcentral.com/create-uitabbarcontroller/</link>
		<comments>http://www.iphonedevcentral.com/create-uitabbarcontroller/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 06:34:28 +0000</pubDate>
		<dc:creator>Vladimir Olexa</dc:creator>
				<category><![CDATA[IDC]]></category>
		<category><![CDATA[sdk]]></category>

		<guid isPermaLink="false">http://www.iphonedevcentral.com/?p=128</guid>
		<description><![CDATA[Tab bar based apps are probably as common as table-based apps and it&#8217;s even more common to see them combined. That&#8217;s what we&#8217;re going to do in this tutorial.
There is a very easy way of creating a tab bar application. In fact, it&#8217;s so easy it requires no work whatsoever. When you choose to create [...]]]></description>
			<content:encoded><![CDATA[<p>Tab bar based apps are probably as common as table-based apps and it&#8217;s even more common to see them combined. That&#8217;s what we&#8217;re going to do in this tutorial.</p>
<p>There is a very easy way of creating a tab bar application. In fact, it&#8217;s so easy it requires no work whatsoever. When you choose to create a new iPhone application in Xcode, one of the options is <em>Tab Bar Application.</em> Just the bare-bones template provided by Apple gives you a fully-functioning app with two tabs. That is not what this tutorial will be about. We are going to create a tab bar controller programatically. It&#8217;s really a lot easier than most people think.</p>
<h3>Prerequisites</h3>
<p>This tutorial is a continuation of my <a href="http://www.iphonedevcentral.com/tutorials.php" target="_blank">previous tutorials</a> so if you haven&#8217;t followed them, it&#8217;s a good time to catch up.</p>
<p>We&#8217;re going to be starting off from a slightly modified version of the previous source code. You can download the primer code for this tutorial here: <a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/09/MyDVDLibrary04Primer.zip">MyDVDLibrary04Primer</a>. The only changes made were some name changes (<em>DetailViewController</em> became <em>DvdInfoViewController</em>) and I organized all classes into groups.</p>
<p>Also, I&#8217;ve recently upgraded to OS X Snow Leopard + Xcode 3.2 with iPhone SDK 3.0 (not 3.1 yet) so the project was compiled on that platform.</p>
<p><span id="more-128"></span></p>
<h3>1. Create DetailViewTabBarController class</h3>
<p>We&#8217;re going to add a view controller that will create a tab bar controller with three tabs: Info, Stats and Borrowers. Each of the tabs will be a separate, self-contained view controller. We already created one of them, <em>DvdInfoViewController</em>, which was previously called <em>DetailViewController</em>. The reason I renamed it is that the real detail view controller will now be our tab bar controller.</p>
<p>In Xcode, right-click on the <em>View Controllers</em> folder from the the <em>Groups &amp; Files</em> panel on the left and choose <em>Add -&gt; New File</em>. Choose <em>UIViewController subclass</em> from the <em>Cocoa Touch Class section </em>and click <em>Next</em>. Name the file <em>DetailViewTabBarController</em>.</p>
<p><em>Note: You may be wondering why we didn&#8217;t choose a UITabBarController subclass instead. As you can see that option wasn&#8217;t even offered. This is because UITabBarController is not meant to be subclassed. Instead, we create a generic view controller to which a tab bar controller will be assigned. </em></p>
<h3>2. Create DvdStatsViewController and DvdBorrowersViewController</h3>
<p>These are the new view controllers I mentioned previously. We already have our <em>DvdInfoViewController</em> that will be in the first tab, so let&#8217;s create the remaining two.</p>
<p>In Xcode, right-click on the <em>View Controllers</em> folder and choose <em>Add -&gt; New File</em>. Choose <em>UIViewController subclass</em> and name the file <em>DvdStatsViewController</em>.</p>
<p>To create <em>DvdBorrowersViewController</em> do the same thing, only name it <em>DvdBorrowersViewController</em>.</p>
<p>That&#8217;s it about those two controllers for now. I&#8217;m not going to cover actually filling them with any content since that&#8217;s not the point of this tutorial. We will leave them here as placeholders for future tutorials when we cover Core Data and RSS feed processing.</p>
<h3>3. Set up DetailViewTabBarController</h3>
<p>Since we&#8217;re going to be coming to the tab bar controller from the <em>RootViewController</em>, we need to pass it DVD info from the row that was tapped. We can do that in a custom init method in <em>DetailViewTabBarController</em>. You&#8217;ll see how it&#8217;s used later when we instantiate it in <em>didSelectRowAtIndexPath</em> method of <em>RootViewController</em>.</p>
<p>We&#8217;re also going to need a handle on the data about the DVD that was tapped on the front page.</p>
<p>Declare it all in <em>DetailViewTabBarController.h</em></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@interface</span> DetailViewTabBarController <span style="color: #002200;">:</span> UIViewController <span style="color: #002200;">&#123;</span>
    <span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span>dvdData;
<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithDvdData<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>data;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>Next, let&#8217;s define <em>initWithDvdData</em> in <em>DetailViewTabBarController.m</em></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithDvdData<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>data <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>self <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>super init<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        dvdData <span style="color: #002200;">=</span> data;
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">return</span> self;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>All we&#8217;re doing here is setting local instance variable <em>dvdData</em> to whatever is passed in. We now have a handle on the DVD data and can use it across all the view controllers.</p>
<h3>4. Implement loadView method in DetailViewTabBarController</h3>
<p><em>loadView</em> is a method on UIViewController that can be overridden in case you want to build your view from ground up. That&#8217;s exactly what we want to do so let&#8217;s override <em>loadView</em> now. Let&#8217;s discuss it piece by piece;</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>loadView <span style="color: #002200;">&#123;</span>
    UIView <span style="color: #002200;">*</span>contentView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIView alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIScreen mainScreen<span style="color: #002200;">&#93;</span> applicationFrame<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
	contentView.backgroundColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor whiteColor<span style="color: #002200;">&#93;</span>;
	self.view <span style="color: #002200;">=</span> contentView;
	<span style="color: #002200;">&#91;</span>contentView release<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Borrowing the biblical line; in the beginning there was nothing, we need a base view to build upon. So we created an empty view with a white background that takes up the whole screen. We will attach all the other views to it.</p>
<p>Now we need to instantiate all three of our controllers. Each one will become one tab in the tab view.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">    <span style="color: #11740a; font-style: italic;">// Declare all three view controllers</span>
    DvdInfoViewController <span style="color: #002200;">*</span>dvdInfoController <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>DvdInfoViewController alloc<span style="color: #002200;">&#93;</span>
                                                initWithDvdData<span style="color: #002200;">:</span>dvdData
                                                nibName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;DetailViewController&quot;</span> bundle<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSBundle</span> mainBundle<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    DvdStatsViewController <span style="color: #002200;">*</span>dvdStatsViewController <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>DvdStatsViewController alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
    DvdBorrowersViewController <span style="color: #002200;">*</span>dvdBorrowersViewController <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>DvdBorrowersViewController alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #11740a; font-style: italic;">// Set a title for each view controller. These will also be names of each tab</span>
    dvdInfoController.title <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Info&quot;</span>;
    dvdStatsViewController.title <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Stats&quot;</span>;
    dvdBorrowersViewController.title <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Borrowers&quot;</span>;</pre></div></div>

<p>You see the <em>dvdInfoController</em> is initialized the same way we did it before in <em>RootViewController</em>. We pass it <em>dvdData</em> that we get from our custom initialization method.</p>
<p>Now the meat of this method, let&#8217;s create the actual tab bar controller and give it the three view controllers. You can note that we&#8217;re setting the bounding frame to be 320 pixels wide and 460 pixels high. We shave off 20 pixels because the title bar is already taking up, well, 20 pixels.</p>
<p>UITabBarController creates tabs when you call setViewControllers on it and pass it an array with your controllers in it. That&#8217;s what&#8217;s happening here.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">    <span style="color: #11740a; font-style: italic;">// Create an empty tab controller and set it to fill the screen minus the top title bar</span>
    UITabBarController <span style="color: #002200;">*</span>tabBarController <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UITabBarController alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
	tabBarController.view.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">320</span>, <span style="color: #2400d9;">460</span><span style="color: #002200;">&#41;</span>;
&nbsp;
    <span style="color: #11740a; font-style: italic;">// Set each tab to show an appropriate view controller</span>
    <span style="color: #002200;">&#91;</span>tabBarController setViewControllers<span style="color: #002200;">:</span>
     <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSArray</span> arrayWithObjects<span style="color: #002200;">:</span>dvdInfoController, dvdStatsViewController, dvdBorrowersViewController, <span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>And finally, let&#8217;s clean up objects we no longer need from memory and add the tab controller view to our parent view so we can actually see it.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">    <span style="color: #11740a; font-style: italic;">// Clean up objects we don't need anymore</span>
    <span style="color: #002200;">&#91;</span>dvdInfoController release<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>dvdStatsViewController release<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>dvdBorrowersViewController release<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #11740a; font-style: italic;">// Finally, add the tab controller view to the parent view</span>
    <span style="color: #002200;">&#91;</span>self.view addSubview<span style="color: #002200;">:</span>tabBarController.view<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<h3>5. Modify RootViewController&#8217;s didSelectRowAtIndexPath method to display DetailViewTabBarController</h3>
<p>The last step we need to take is to modify <em>didSelectRowAtIndexPath</em> in <em>RootViewController</em> to display our newly created tab bar controller instead of the <em>DvdInfoViewController</em> we showed in the last tutorial.</p>
<p>Open up <em>RootViewController.m</em> and modify <em>didSelectRowAtIndexPath</em> to look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>tableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView didSelectRowAtIndexPath<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSIndexPath</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>indexPath <span style="color: #002200;">&#123;</span>
    DetailViewTabBarController <span style="color: #002200;">*</span>controller <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>DetailViewTabBarController alloc<span style="color: #002200;">&#93;</span>
                                              initWithDvdData<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>dao libraryItemAtIndex<span style="color: #002200;">:</span>indexPath.row<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    controller.title <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>dao libraryItemAtIndex<span style="color: #002200;">:</span>indexPath.row<span style="color: #002200;">&#93;</span> valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;title&quot;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>self.navigationController pushViewController<span style="color: #002200;">:</span>controller animated<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>controller release<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>At this point, you can run your project and tapping on a DVD title should take you to the tab bar controller which has three tabs. The first tab contains the movie info, the remaining two are empty. As I mentioned before, we&#8217;ll fill those in in the later tutorials or it can be left as an exercise for the reader.</p>
<h3>6. Add icon to tabs</h3>
<p>The tabs now only have a textual title. Let&#8217;s make it prettier by adding an icon to each of them. I only use one image (included in the project) for demonstration purposes but you can have a different image for each tab. The image should be 32&#215;32 pixels PNG file. You don&#8217;t need to to create the pretty, shiny, gray and blue images. Just pass it a normal image and the SDK will do the rest.</p>
<p>Add this in the <em>loadView</em> method in <em>DetailViewTabBarViewController.m</em> implementation file right after we set the titles of the controllers:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">    <span style="color: #11740a; font-style: italic;">// Set a title for each view controller. These will also be names of each tab</span>
    dvdInfoController.title <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Info&quot;</span>;
    dvdStatsViewController.title <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Stats&quot;</span>;
    dvdBorrowersViewController.title <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Borrowers&quot;</span>;
&nbsp;
    dvdInfoController.tabBarItem.image <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;dvdicon.png&quot;</span><span style="color: #002200;">&#93;</span>;
    dvdStatsViewController.tabBarItem.image <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;dvdicon.png&quot;</span><span style="color: #002200;">&#93;</span>;
    dvdBorrowersViewController.tabBarItem.image <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;dvdicon.png&quot;</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>If everything went well, you should see your app looking like this</p>
<p><a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/09/tutorial020.jpg"><img class="aligncenter size-medium wp-image-134" title="tutorial020" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/09/tutorial020-157x300.jpg" alt="tutorial020" width="157" height="300" /></a></p>
<h3>Conclusion</h3>
<p>While it may seem easier to create everything in the Interface Builder, you can see that in this case creating a tab bar controller was a breeze. Adding new tabs/view controllers to it is as easy as adding an object to an array. I hope this tutorial connecting the dots how to go from a table view to a tab bar view in a navigation-based application.</p>
<p>You can download the complete source code to this tutorial here: <a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/09/MyDVDLibrary041.zip">My DVD Library Tutorial 4</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonedevcentral.com/create-uitabbarcontroller/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Create a Detail View Page using UIImageView, UITextView and UILabel</title>
		<link>http://www.iphonedevcentral.com/create-a-detail-view-page-using-uiimageview-uitextview-and-uilabel/</link>
		<comments>http://www.iphonedevcentral.com/create-a-detail-view-page-using-uiimageview-uitextview-and-uilabel/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 01:28:35 +0000</pubDate>
		<dc:creator>Vladimir Olexa</dc:creator>
				<category><![CDATA[IDC]]></category>
		<category><![CDATA[sdk]]></category>

		<guid isPermaLink="false">http://www.iphonedevcentral.com/?p=105</guid>
		<description><![CDATA[
I&#8217;m going to build this tutorial on the previous two so if you haven&#8217;t checked them out yet, you can see the first one here and the second one here. You can also download the source code on the bottom of each tutorial.
What we&#8217;ve done so far
We used UITableViewController to build out our root view [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/08/tutorial019.jpg"><img class="aligncenter size-medium wp-image-119" title="tutorial019" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/08/tutorial019-158x300.jpg" alt="tutorial019" width="158" height="300" /></a></p>
<p>I&#8217;m going to build this tutorial on the previous two so if you haven&#8217;t checked them out yet, you can see the <a href="http://www.iphonedevcentral.com/?p=15">first one here</a> and the <a href="http://www.iphonedevcentral.com/?p=66">second one here</a>. You can also download the source code on the bottom of each tutorial.</p>
<h3>What we&#8217;ve done so far</h3>
<p>We used UITableViewController to build out our root view controller that lists all the DVDs from our data file. Then we customized each cell by adding a DVD cover and some basic info about each movie. Tapping a row in the table caused the app to go to a detail page which was also a table displaying expanded info about the selected movie. That&#8217;s the part we&#8217;re going to work on now.</p>
<h3>1. Download some source code to get your started</h3>
<p>Since we&#8217;re going to be completely removing the detail view controller we used in the previous tutorials, let&#8217;s just start from there. Instead of walking you through deleting the controller and removing the appropriate functionality, download this source code that will get you started. You&#8217;ll get the root view controller with customized cells in it. However, tapping on any of the rows won&#8217;t do anything, yet. Download the primer project here: <a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/08/MyDVDLibrary03Primer.zip">MyDVDLibrary03Primer</a>.</p>
<h3>2. Enhance test data file</h3>
<p>Since our test data file only contains title, length, image and release date for each movie, that&#8217;s not going to cut it when trying to design a detail view page. We&#8217;ll at least want to add the description of the movie and maybe also its genre. This can be very tedious to do in a <em>plist</em> like we&#8217;re using right now but it will get a lot easier once we start using Core Data that I will cover in later tutorials.</p>
<p>I won&#8217;t make you add all the data by hand so for a shortcut, download the completed <em>plist</em> file here and replace your existing one that can be found in Xcode under the <em>Resources</em> folder: <a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/08/TestData.plist">TestData.plist</a>.</p>
<h3>3. Create new DetailViewController class</h3>
<p>In Xcode&#8217;s file browser on the left, right-click on the <em>Classes</em> folder and choose <em>Add -&gt; New File&#8230;</em> . Under <em>Cocoa Touch Classes</em> group choose <em>UIViewController subclass</em> and make sure to check the <em>With XIB for user interface</em> checkbox. This will not only create our subclass but also the NIB file that we&#8217;ll use to layout our UI components.</p>
<p><a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/08/tutorial015.jpg"><br />
<img class="aligncenter size-medium wp-image-108" title="tutorial015" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/08/tutorial015-300x235.jpg" alt="tutorial015" width="300" height="235" /></a></p>
<p><span id="more-105"></span></p>
<h3>4. Set up UI outlets</h3>
<p>We now need to set up all properties in our controller that will be used on the detail view page. There will be an image view for the DVD cover, a label for the title, release date, length, genre and a text view for the description. Add this to the header file of the <em>DetailViewController</em> (<em>DetailViewController.h</em>):</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@interface</span> DetailViewController <span style="color: #002200;">:</span> UIViewController <span style="color: #002200;">&#123;</span>
    IBOutlet UIImageView <span style="color: #002200;">*</span>coverImageView;
    IBOutlet UILabel <span style="color: #002200;">*</span>titleLabel;
    IBOutlet UILabel <span style="color: #002200;">*</span>releaseDateLabel;
    IBOutlet UILabel <span style="color: #002200;">*</span>lengthLabel;
    IBOutlet UILabel <span style="color: #002200;">*</span>genreLabel;
    IBOutlet UITextView <span style="color: #002200;">*</span>descriptionTextView;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> UIImageView <span style="color: #002200;">*</span>coverImageView;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> UILabel <span style="color: #002200;">*</span>titleLabel;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> UILabel <span style="color: #002200;">*</span>releaseDateLabel;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> UILabel <span style="color: #002200;">*</span>lengthLabel;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> UILabel <span style="color: #002200;">*</span>genreLabel;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> UITextView <span style="color: #002200;">*</span>descriptionTextView;
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>Synthesize the properties in the implementation file (<em>DetailViewController.m</em>):</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@synthesize</span> coverImageView, titleLabel, releaseDateLabel, lengthLabel, genreLabel, descriptionTextView;</pre></div></div>

<h3>5. Lay out and connect UI components in Interface Builder</h3>
<p>Before we jump to Interface Builder make sure to save all the changes so that IB can pick up on them.</p>
<p>In Xcode, locate DetailViewController.xib file (it got created this file along with <em>DetailViewController</em> class in Step#3) and double-click on it. Once Interface Builder opens you should see an empty canvas where we&#8217;re going to place our UI elements. Lay them out as shown in the screenshot below. Note that you should uncheck <em>Editable</em> checkbox on your text view so that the text is read-only.</p>
<p><img class="aligncenter size-full wp-image-117" title="tutorial016" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/08/tutorial0161.jpg" alt="tutorial016" width="322" height="504" /></p>
<p>Now we need to connect the UI elements to its variable counterparts. I&#8217;m not going to cover step-by-step how to do that as it has been discussed in some detail in the <a href="http://www.iphonedevcentral.com/?p=66" target="_blank">tutorial on customizing view cells</a>. Please, review that tutorial if you&#8217;re unclear how to follow the next set of instructions.</p>
<p>Click on <em>File&#8217;s Owner</em> icon to highlight it. From the file menu choose <em>Tools -&gt; Connections Inspector</em> (Cmd + 2). Under <em>Outlets</em>, you&#8217;ll see all of our instance variables we declared in the <em>DetailViewController</em> class. Control-drag from <em>File&#8217;s Owner</em> to each UI component in the view to connect <em>coverImageView</em> to <em>Image View</em>, <em>releaseDateLabel</em> to <em>Release Date</em> label, <em>genreLabel</em> to <em>Genre</em> label, etc. Once done, your Connections Inspector should be set up like this:</p>
<p><img class="aligncenter size-full wp-image-112" title="tutorial017" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/08/tutorial017.jpg" alt="tutorial017" width="290" height="305" /></p>
<p>Save your changes and return back to Xcode.</p>
<h3>6. Prepare DetailViewController to read test data</h3>
<p>If you recall what we did with the original <em>DetailViewController</em> when it was still a table, in its initialization method we passed in a dictionary containing all the info about our DVD library. This was read in using <em>DvdLibraryDao</em> object that basically took the <em>plist</em> we constructed earlier and put all its content into a dictionary. We&#8217;re going to do the same thing in our new <em>DetailViewController</em>, only we&#8217;re now adding a couple of properties (genre, description) that we just added in Step#2.</p>
<p>We also add declaration of our custom initialization method here. It&#8217;s pretty much just a modified <em>initWithNibName</em> method that adds <em>dvdData</em> into the mix. This method will set the local instance variable dvdData that is also declared here. Change <em>DetailViewController.h</em> header file to look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@interface</span> DetailViewController <span style="color: #002200;">:</span> UIViewController <span style="color: #002200;">&#123;</span>
    IBOutlet UIImageView <span style="color: #002200;">*</span>coverImageView;
    IBOutlet UILabel <span style="color: #002200;">*</span>titleLabel;
    IBOutlet UILabel <span style="color: #002200;">*</span>releaseDateLabel;
    IBOutlet UILabel <span style="color: #002200;">*</span>lengthLabel;
    IBOutlet UILabel <span style="color: #002200;">*</span>genreLabel;
    IBOutlet UITextView <span style="color: #002200;">*</span>descriptionTextView;
&nbsp;
    <span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span>dvdData;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> UIImageView <span style="color: #002200;">*</span>coverImageView;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> UILabel <span style="color: #002200;">*</span>titleLabel;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> UILabel <span style="color: #002200;">*</span>releaseDateLabel;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> UILabel <span style="color: #002200;">*</span>lengthLabel;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> UILabel <span style="color: #002200;">*</span>genreLabel;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, retain<span style="color: #002200;">&#41;</span> UITextView <span style="color: #002200;">*</span>descriptionTextView;
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithDvdData<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>dvdData nibName<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>nibNameOrNil bundle<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSBundle</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>nibBundleOrNil;
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>Switch over to <em>DetailViewController.m</em> implementation file. Let&#8217;s implement the <em>initWithDvdData</em> method:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithDvdData<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>data nibName<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>nibNameOrNil bundle<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSBundle</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>nibBundleOrNil <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>self <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>super initWithNibName<span style="color: #002200;">:</span>nibNameOrNil bundle<span style="color: #002200;">:</span>nibBundleOrNil<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        dvdData <span style="color: #002200;">=</span> data;
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">return</span> self;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>All this is doing is it assigns <em>data</em> that is passed in to our instance variable <em>dvdData</em>.</p>
<p>To read everything in from <em>dvdData</em> to all of the UI elements, we&#8217;ll insert a little snippet of code in the <em>viewDidLoad</em> delegate method. As you can see, we assign each value from <em>dvdData</em> to its corresponding UI element.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewDidLoad <span style="color: #002200;">&#123;</span>
    coverImageView.image <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>dvdData valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;coverImage&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    titleLabel.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dvdData valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;title&quot;</span><span style="color: #002200;">&#93;</span>;
    releaseDateLabel.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%@&quot;</span>, <span style="color: #002200;">&#91;</span>dvdData valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;releaseDate&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    lengthLabel.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%@ minutes&quot;</span>, <span style="color: #002200;">&#91;</span>dvdData valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;featureLength&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    genreLabel.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dvdData valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;genre&quot;</span><span style="color: #002200;">&#93;</span>;
    descriptionTextView.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dvdData valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;description&quot;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>super viewDidLoad<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<h3>7. Handle didSelectRowAtIndexPath in RootViewController</h3>
<p>Now that we have our detail view controller all ready to go, let&#8217;s connect the dots and have the <em>RootViewController</em> go to the detail page when a row is tapped.</p>
<p>In RootViewController.m, locate the didSelectRowAtIndexPath method. Just as we did before, we&#8217;ll instantiate <em>DetailViewController</em> here and push it to the controller stack:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>tableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView didSelectRowAtIndexPath<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSIndexPath</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>indexPath <span style="color: #002200;">&#123;</span>
    DetailViewController <span style="color: #002200;">*</span>controller <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>DetailViewController alloc<span style="color: #002200;">&#93;</span>
                                        initWithDvdData<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>dao libraryItemAtIndex<span style="color: #002200;">:</span>indexPath.row<span style="color: #002200;">&#93;</span>
                                        nibName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;DetailViewController&quot;</span> bundle<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSBundle</span> mainBundle<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    controller.title <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>dao libraryItemAtIndex<span style="color: #002200;">:</span>indexPath.row<span style="color: #002200;">&#93;</span> valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;title&quot;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>self.navigationController pushViewController<span style="color: #002200;">:</span>controller animated<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>controller release<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>If everything went well, you should be able to run your project and get something like this:</p>
<p><a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/08/tutorial018.jpg"><img class="aligncenter size-medium wp-image-118" title="tutorial018" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/08/tutorial018-158x300.jpg" alt="tutorial018" width="158" height="300" /></a></p>
<h3>8. Format the release date field</h3>
<p>While something like <em>2007-07-08 16:32:07 -0700</em> is completely acceptable by me, many people want to see something a bit more user friendly. Let&#8217;s take that date and try to display it as <em>July 8, 2007</em>.  We&#8217;re going to achieve that using a nifty utility class called NSDateFormatter. Open <em>DetailViewController.m</em> and change <em>viewDidLoad</em> method to look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewDidLoad <span style="color: #002200;">&#123;</span>
    coverImageView.image <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>dvdData valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;coverImage&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    titleLabel.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dvdData valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;title&quot;</span><span style="color: #002200;">&#93;</span>;
    lengthLabel.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%@ minutes&quot;</span>, <span style="color: #002200;">&#91;</span>dvdData valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;featureLength&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    genreLabel.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dvdData valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;genre&quot;</span><span style="color: #002200;">&#93;</span>;
    descriptionTextView.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dvdData valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;description&quot;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #11740a; font-style: italic;">// Format date we get from releaseDate field to more readable form</span>
    <span style="color: #400080;">NSDate</span> <span style="color: #002200;">*</span>releaseDate <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSDate</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#91;</span>dvdData valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;releaseDate&quot;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #400080;">NSDateFormatter</span> <span style="color: #002200;">*</span>dateFormatter <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDateFormatter</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>dateFormatter setDateFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;MMMM d, YYYY&quot;</span><span style="color: #002200;">&#93;</span>;
    releaseDateLabel.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>dateFormatter stringFromDate<span style="color: #002200;">:</span>releaseDate<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #002200;">&#91;</span>super viewDidLoad<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>All we had done is gave our formatter a string representation of the date format we want and then outputted that date to <em>releaseDateLabel</em>.</p>
<h3>Conclusion</h3>
<p>When customizing your detail views, possibilities are endless. You could add a texture to your background, add more images, maybe a table with some detailed information, or other controls that would take you forward in the controller stack. But I hope this tutorial got you started and showed you some basic techniques and tricks to create a detail page.</p>
<p>You can download the complete source code to this tutorial here: <a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/08/MyDVDLibrary03.zip">My DVD Library Tutorial 3</a></p>
<p><img class="aligncenter size-full wp-image-119" title="tutorial019" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/08/tutorial019.jpg" alt="tutorial019" width="386" height="729" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonedevcentral.com/create-a-detail-view-page-using-uiimageview-uitextview-and-uilabel/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>A bit about me&#8230;</title>
		<link>http://www.iphonedevcentral.com/a-bit-about-me/</link>
		<comments>http://www.iphonedevcentral.com/a-bit-about-me/#comments</comments>
		<pubDate>Mon, 21 Jan 2008 08:16:10 +0000</pubDate>
		<dc:creator>Vladimir Olexa</dc:creator>
				<category><![CDATA[IDC]]></category>

		<guid isPermaLink="false">http://www.iphonedevcentral.com/?p=4</guid>
		<description><![CDATA[My name is Vladimir Olexa and I currently work as a software engineer for CNET Networks. I&#8217;m the creator of CNET&#8217;s iPhone app. 
As an iPhone developer, I want this site to be a good resource for tips, tricks, tutorials, articles and other material that will help all of you interested in iPhone development get [...]]]></description>
			<content:encoded><![CDATA[<p>My name is <a href="http://www.olxdev.com" target="_blank" onclick="urchinTracker('/outgoing/www.olxdev.com?referer=');">Vladimir Olexa</a> and I currently work as a software engineer for <a href="http://www.cnet.com" target="_blank" onclick="urchinTracker('/outgoing/www.cnet.com?referer=');">CNET Networks</a>. I&#8217;m the creator of <a href="http://www.cnet.com" target="_blank" onclick="urchinTracker('/outgoing/www.cnet.com?referer=');">CNET&#8217;s</a> <a href="http://iphone.cnet.com" target="_blank" onclick="urchinTracker('/outgoing/iphone.cnet.com?referer=');">iPhone app</a>. </p>
<p>As an iPhone developer, I want this site to be a good resource for tips, tricks, tutorials, articles and other material that will help all of you interested in iPhone development get started and get developing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonedevcentral.com/a-bit-about-me/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

