<?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];</title>
	<atom:link href="http://www.iphonedevcentral.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.iphonedevcentral.com</link>
	<description></description>
	<lastBuildDate>Fri, 28 May 2010 00:54:09 +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>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>Create Indexed UITableView</title>
		<link>http://www.iphonedevcentral.com/indexed-uitableview-tutorial/</link>
		<comments>http://www.iphonedevcentral.com/indexed-uitableview-tutorial/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 19:44:02 +0000</pubDate>
		<dc:creator>Vladimir Olexa</dc:creator>
				<category><![CDATA[sdk]]></category>

		<guid isPermaLink="false">http://www.iphonedevcentral.com/?p=145</guid>
		<description><![CDATA[Tackling that handy index on the right side of table views is really not that complicated. In fact, it only requires that you implement two methods. In this tutorial, I&#8217;m going to take you step-by-step on how to wire it all together.


Prerequisites
If you were able to follow my previous tutorials, you&#8217;re going to be just [...]]]></description>
			<content:encoded><![CDATA[<p>Tackling that handy index on the right side of table views is really not that complicated. In fact, it only requires that you implement two methods. In this tutorial, I&#8217;m going to take you step-by-step on how to wire it all together.</p>
<p><img class="aligncenter size-full wp-image-163" title="Indexed Table 2" src="http://www.iphonedevcentral.com/wp-content/uploads/2010/02/indexedtable021.jpg" alt="Indexed Table 2" width="269" height="500" /></p>
<p><span id="more-145"></span></p>
<h3>Prerequisites</h3>
<p>If you were able to follow my previous <a href="http://www.iphonedevcentral.com/tutorials.php">tutorials</a>, you&#8217;re going to be just fine with this one.  I assume that you have <a href="http://developer.apple.com/iphone/" target="_blank" onclick="urchinTracker('/outgoing/developer.apple.com/iphone/?referer=');">iPhone SDK 3.x</a> downloaded and installed, know how to create an empty project and files in Xcode and know a thing or two about Objective-C and Cocoa touch. While I am using iPhone SDK 3.2 Beta, I compiled this project against version 3.1.3, which is the current live version.</p>
<p>Let&#8217;s get started!</p>
<h3>1 .Set up your project</h3>
<p>In Xcode, go to <em>File -&gt; New Project</em> and choose <em>Navigation-based Application</em> from the iPhone OS tab. Name the application <em>IndexedTable</em>. At this point, you should have a runnable app with an empty table in it.</p>
<h3>2. Create a data source</h3>
<p>Instead of hardcoding a bunch of values, country names and whatnot, let&#8217;s create a simple method that will generate a bunch of strings from the letters of the alphabet so that our UITableView has something to work with.</p>
<p>Create a new class called <em>DataGenerator</em>. Right-click on the <em>Classes</em> group in the project browser and choose <em>New File</em>. Let the file be an <em>Objective-C class</em> (subclass of NSObject) and name it <em>DataGenerator</em>. This class will only have one static method (for now) that will simply return an array of words from letters. As such, we&#8217;ll name it <em>wordsFromLetters</em>.</p>
<p>In <em>DataGenerator.h</em>, insert the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@interface</span> DataGenerator <span style="color: #002200;">:</span> <span style="color: #400080;">NSObject</span> <span style="color: #002200;">&#123;</span>
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> wordsFromLetters;
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>Now, let&#8217;s implement this method. Open <em>DataGenerator.m</em> and put this code in it:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@implementation</span> DataGenerator
&nbsp;
<span style="color: #6e371a;">#define WORD_LENGTH 5</span>
&nbsp;
<span style="color: #a61390;">static</span> <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>letters <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;abcdefghijklmnopqrstuvwxyz&quot;</span>;
&nbsp;
<span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> wordsFromLetters <span style="color: #002200;">&#123;</span>
    <span style="color: #400080;">NSMutableArray</span> <span style="color: #002200;">*</span>content <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableArray</span> new<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span> i <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>; i &lt; <span style="color: #002200;">&#91;</span>letters length<span style="color: #002200;">&#93;</span>; i<span style="color: #002200;">++</span> <span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #400080;">NSMutableDictionary</span> <span style="color: #002200;">*</span>row <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;">NSMutableDictionary</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: #a61390;">char</span> currentWord<span style="color: #002200;">&#91;</span>WORD_LENGTH <span style="color: #002200;">+</span> <span style="color: #2400d9;">1</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #400080;">NSMutableArray</span> <span style="color: #002200;">*</span>words <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;">NSMutableArray</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
&nbsp;
        <span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span> j <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>; j &lt; WORD_LENGTH; j<span style="color: #002200;">++</span> <span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
            <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>j <span style="color: #002200;">==</span> <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                currentWord<span style="color: #002200;">&#91;</span>j<span style="color: #002200;">&#93;</span> <span style="color: #002200;">=</span> <span style="color: #a61390;">toupper</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>letters characterAtIndex<span style="color: #002200;">:</span>i<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
            <span style="color: #002200;">&#125;</span>
            <span style="color: #a61390;">else</span> <span style="color: #002200;">&#123;</span>
                currentWord<span style="color: #002200;">&#91;</span>j<span style="color: #002200;">&#93;</span> <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>letters characterAtIndex<span style="color: #002200;">:</span>i<span style="color: #002200;">&#93;</span>;
            <span style="color: #002200;">&#125;</span>
            currentWord<span style="color: #002200;">&#91;</span>j<span style="color: #002200;">+</span><span style="color: #2400d9;">1</span><span style="color: #002200;">&#93;</span> <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">'<span style="color: #2400d9;">\0</span>'</span>;
            <span style="color: #002200;">&#91;</span>words addObject<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithCString<span style="color: #002200;">:</span>currentWord encoding<span style="color: #002200;">:</span>NSASCIIStringEncoding<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#125;</span>
        <span style="color: #a61390;">char</span> currentLetter<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">2</span><span style="color: #002200;">&#93;</span> <span style="color: #002200;">=</span> <span style="color: #002200;">&#123;</span> <span style="color: #a61390;">toupper</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>letters characterAtIndex<span style="color: #002200;">:</span>i<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>, <span style="color: #bf1d1a;">'<span style="color: #2400d9;">\0</span>'</span><span style="color: #002200;">&#125;</span>;
        <span style="color: #002200;">&#91;</span>row setValue<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithCString<span style="color: #002200;">:</span>currentLetter encoding<span style="color: #002200;">:</span>NSASCIIStringEncoding<span style="color: #002200;">&#93;</span>
               forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;headerTitle&quot;</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>row setValue<span style="color: #002200;">:</span>words forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;rowValues&quot;</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>content addObject<span style="color: #002200;">:</span>row<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
    <span style="color: #a61390;">return</span> content;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>I&#8217;m not going to spend a whole of time explaining what&#8217;s going on here because this tutorial is really about adding an index bar to your UITableView. But let&#8217;s briefly talk what&#8217;s it all about. This method loops through an array letters one-by-one. For each letter it then generates a bunch of words to fill up our content. The final structure of the NSArray we&#8217;re returning is going to look something like this:</p>
<p><strong>NSArray =&gt;</strong></p>
<ol>
<li><strong>NSDictionary</strong>
<ul>
<li><em>headerTitle</em> =&gt; &#8216;A&#8217;</li>
<li><em>rowValues</em> =&gt; {&#8221;A&#8221;, &#8220;Aa&#8221;, &#8220;Aaa&#8221;, &#8220;Aaaa&#8221;}</li>
</ul>
</li>
<li><strong>NSDictionary</strong>
<ul>
<li><em>headerTitle</em> =&gt; &#8216;B&#8217;</li>
<li><em>rowValues</em> =&gt; {&#8221;B&#8221;, &#8220;Bb&#8221;, &#8220;Bbb&#8221;, &#8220;Bbbb&#8221;}</li>
</ul>
</li>
<li>etc.</li>
</ol>
<p>You&#8217;ll see how we&#8217;re using this array later on. Also note that this list is implicitly ordered.</p>
<h3>3. Fill in UITableView with values from <em>DataGenerator</em></h3>
<p>Next we&#8217;re going to populate the currently empty table with data we get from our data generator. Open <em>RootViewController.h</em> and add these two instance variables to the class:
</pre>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &quot;DataGenerator.h&quot;</span>
&nbsp;
<span style="color: #a61390;">@interface</span> RootViewController <span style="color: #002200;">:</span> UITableViewController <span style="color: #002200;">&#123;</span>
    <span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>content;
    <span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>indices;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p><em>content</em> will hold our array of dictionaries while <em>indices</em> will hold all initial letters for each word in the list. Let's fill those up. Open <em>RootViewController.m</em> implementation file and override the method <em>viewDidLoad</em> with the following:</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>
    <span style="color: #002200;">&#91;</span>super viewDidLoad<span style="color: #002200;">&#93;</span>;
    content <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>DataGenerator wordsFromLetters<span style="color: #002200;">&#93;</span>;
    indices <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>content valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;headerTitle&quot;</span><span style="color: #002200;">&#93;</span> retain<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>You can see that we're using <em>[DataGenerator wordsFromLetters]</em> to simply fill in the <em>content</em> variable. The second line of that method returns all keys from the dictionaries in <em>content</em> as an array. So <em>indices</em> now holds all letters of the alphabet.</p>
<p>We next override the two methods that tell our UITableView how many sections it has and how many rows there are in each section.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Customize the number of sections in the table view.</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>numberOfSectionsInTableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>content count<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">// Customize the number of rows in the table view.</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSInteger<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 numberOfRowsInSection<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>section <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>content objectAtIndex<span style="color: #002200;">:</span>section<span style="color: #002200;">&#93;</span> objectForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;rowValues&quot;</span><span style="color: #002200;">&#93;</span> count<span style="color: #002200;">&#93;</span> ;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>The number of sections is equal to the number of letters in our list and the number of rows of each section is equal to the count of each array under its corresponding letter.</p>
<p>Finally, we implement <em>cellForRowAtIndexPath</em> so that it displays words from our list in the table. We handle headers for sections in <em>titleForHeaderInSection</em>. This method queries our content at a particular section and demands a <em>headerTitle</em> to be returned as header of that section.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Customize the appearance of table view cells.</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>UITableViewCell <span style="color: #002200;">*</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 cellForRowAtIndexPath<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>
&nbsp;
    <span style="color: #a61390;">static</span> <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>CellIdentifier <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Cell&quot;</span>;
&nbsp;
    UITableViewCell <span style="color: #002200;">*</span>cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>tableView dequeueReusableCellWithIdentifier<span style="color: #002200;">:</span>CellIdentifier<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>cell <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UITableViewCell alloc<span style="color: #002200;">&#93;</span> initWithStyle<span style="color: #002200;">:</span>UITableViewCellStyleDefault
                                       reuseIdentifier<span style="color: #002200;">:</span>CellIdentifier<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
    cell.textLabel.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>content objectAtIndex<span style="color: #002200;">:</span>indexPath.section<span style="color: #002200;">&#93;</span> objectForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;rowValues&quot;</span><span style="color: #002200;">&#93;</span>
                           objectAtIndex<span style="color: #002200;">:</span>indexPath.row<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #a61390;">return</span> cell;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>You should be able to run your app now (CMD + R) and see something like this:</p>
<p><img class="size-full wp-image-158 alignleft" title="Indexed Table 01" src="http://www.iphonedevcentral.com/wp-content/uploads/2010/02/indexedtable01.jpg" alt="Indexed Table 01" width="268" height="500" /></p>
<h3>4. Add index to the table</h3>
<p>There is nothing new in what we've done so far. We simply filled in a UITableView with some data. We're now ready to add our index to it. For that, we'll need to implement two methods: <em>sectionIndexTitlesForTableView</em> and <em>sectionForSectionIndexTitle</em>.</p>
<p>Add this code to <em>RootViewController.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: #400080;">NSArray</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>sectionIndexTitlesForTableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>content valueForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;headerTitle&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSInteger<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 sectionForSectionIndexTitle<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>title atIndex<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>index <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>indices indexOfObject<span style="color: #002200;">:</span>title<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p><strong>sectionIndexTitlesForTableView:</strong> In order to properly render the index, the UITableView needs to know all index titles to display. This method returns an array of strings containing all indices. In our case, A, B, C, D, etc.</p>
<p><strong>sectionForSectionIndexTitle:</strong> When you start scrolling through the index, the table needs to know how far down/up to scroll so that the letter you're touching corresponds the appropriate section in the table. This method returns an index value (integer) of the section you're currently touching in the index.</p>
<p style="text-align: left;">One more thing we need to do before we run our app is to add titles to each section header in UITableView.</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: #400080;">NSString</span> <span style="color: #002200;">*</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>aTableView titleForHeaderInSection<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>section <span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>content objectAtIndex<span style="color: #002200;">:</span>section<span style="color: #002200;">&#93;</span> objectForKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;headerTitle&quot;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #002200;">&#125;</span></pre></div></div>

<h3>5. Run your app</h3>
<p>If everything went well, you should now be able to run your app and see the final product. You'll see the index on the right and scrolling over it will scroll the table appropriately.</p>
<p><img class="aligncenter size-full wp-image-164" title="indexedtable02" src="http://www.iphonedevcentral.com/wp-content/uploads/2010/02/indexedtable022.jpg" alt="indexedtable02" width="269" height="500" /></p>
<h3>Conclusion</h3>
<p>Voilà! That wasn't that hard was it? The main get-away from this tutorial are the two methods you need to implement in order for the index to show up and function properly: <em>sectionIndexTitlesForTableView</em>: and <em>sectionForSectionIndexTitle</em>:. In the next tutorial, we'll cover how to add a search bar to this table.</p>
<p>The complete source code for this tutorial can be found here: <a href="http://www.iphonedevcentral.com/wp-content/uploads/2010/02/IndexedTable.zip">Indexed UITableView</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonedevcentral.com/indexed-uitableview-tutorial/feed/</wfw:commentRss>
		<slash:comments>1</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>21</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>5</slash:comments>
		</item>
		<item>
		<title>Customize that UIViewCell &#8211; Part 1: Using Interface Builder</title>
		<link>http://www.iphonedevcentral.com/customize-that-uiviewcell-part-1-using-interface-builder/</link>
		<comments>http://www.iphonedevcentral.com/customize-that-uiviewcell-part-1-using-interface-builder/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 06:40:05 +0000</pubDate>
		<dc:creator>Vladimir Olexa</dc:creator>
				<category><![CDATA[sdk]]></category>

		<guid isPermaLink="false">http://www.iphonedevcentral.com/?p=66</guid>
		<description><![CDATA[If you followed my first tutorial on UITableView (link &#124; source code), you now have a very simple app that shows a list of DVD titles and clicking any of the titles shows you a detail view page with more information about the DVD.  That&#8217;s all nice but we really want to make it a little [...]]]></description>
			<content:encoded><![CDATA[<p>If you followed my <a href="http://www.iphonedevcentral.com/?p=15" target="_self">first tutorial</a> on UITableView (<a href="http://www.iphonedevcentral.com/?p=15">link</a> | <a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/MyDVDLibrary01.zip">source code</a>), you now have a very simple app that shows a list of DVD titles and clicking any of the titles shows you a detail view page with more information about the DVD.  That&#8217;s all nice but we really want to make it a little bit prettier. We could display the length of each movie right on the listing page. Also, we have this <em>coverImage</em> field in our data set, let&#8217;s use it.</p>
<p>What we want is for our home screen to look like this:</p>
<p><a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial006.jpg"><img class="aligncenter size-medium wp-image-67" title="tutorial006" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial006-161x300.jpg" alt="tutorial006" width="161" height="300" /></a></p>
<p>We can accomplish that by customizing UITableViewCell. There are 2 ways of going about it:</p>
<ol>
<li>Using Interface Builder</li>
<li>Programmatically</li>
</ol>
<p>In reality, you can also choose a hybrid approach where you create some UI elements in the Interface Builder and some programmatically.</p>
<h3>Which option to choose?</h3>
<p>The two approaches both bring some advantages and disadvantages with them.</p>
<p><strong>Interface Builder</strong></p>
<p>If you decide to go the Interface Builder route, you&#8217;ll find it very easy to create and customize your cells. Any subsequent edits can also be done quite easily since you&#8217;re simply rearranging elements visually. The downside is speed and performance since the system needs to render each view in a cell individually. If your table view has thousands of rows in it, this may/may not affect the performance of your app, depending how complicated your cell is.</p>
<p><strong>Programmatically </strong></p>
<p>This one involves a lot more work. You are responsible for creating each UI element by hand in the code. That can be very tedious and any edits you need to make in the future require code changes. Also, you&#8217;ll need to set up all the autosizing masks yourself. The upside is performance. Since the system will draw each cell as one view, the performance gain can be very significant.</p>
<p><span id="more-66"></span>Ok, let&#8217;s get to it&#8230;</p>
<h3>1. Subclass UITableViewCell</h3>
<p>Create a <em>Cocoa Touch Class</em> file and make it a subclass of <em>UITableViewCell</em>. Let&#8217;s name it <em>DVDListingViewCell.m</em>. We&#8217;ll use this class as a placeholder for our labels and the cover image. In <em>DVDListingViewCell.h</em> add the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@interface</span> DVDListingViewCell <span style="color: #002200;">:</span> UITableViewCell <span style="color: #002200;">&#123;</span>
    IBOutlet UILabel <span style="color: #002200;">*</span>titleLabel;
    IBOutlet UIImageView <span style="color: #002200;">*</span>coverImageView;
    IBOutlet UILabel <span style="color: #002200;">*</span>featureLengthLabel;
<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> 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>featureLengthLabel;
<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;
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>We use the <em>IBOutlet</em> annotation here to later let Interface Builder know we want to connect these properties with the actual UI elements we&#8217;ll lay out.</p>
<p>We also need synthesize the properties we&#8217;ve just defined. This will create all setters and getters for us. Add this to <em>DVDListingViewCell.m</em> right below the @implementation directive.</p>

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

<h3>2. Design the cell in Interface Builder</h3>
<p>In Xcode, double-click on any of the nib files (they should all be listed under <em>NIB Files</em> magic folder). Once in Interface Builder, choose <em>New&#8230;</em> from the File menu. You should be presented a dialog with several templates in it. From the <em>Cocoa Touch</em> category on the left, choose <em>Empty</em>.</p>
<p><a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial007.jpg"><img class="aligncenter size-medium wp-image-72" title="tutorial007" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial007-300x287.jpg" alt="tutorial007" width="300" height="287" /></a></p>
<p>You should now see an &#8220;Untitled&#8221; window with <em>File&#8217;s Owner</em> and <em>First Responder</em> in it. One thing missing right now is the actual cell view, let&#8217;s add it. From the <em>Library</em> window (Tools -&gt; Library) locate <em>Table View Cell</em>. Drag it to the &#8220;Untitled&#8221; window. You should now see something like this:</p>
<p><img class="aligncenter size-full wp-image-73" title="tutorial008" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial008.jpg" alt="tutorial008" width="325" height="341" /></p>
<p>Double clicking on the <em>Table View Cell</em> object will open up the actual cell view where we&#8217;re going to add our UI elements. Make the cell 120 pixels in height (you change the dimensions under the size tab in the properties window or by pressing<em> Command  + 3</em>). Drag a couple <em>Lable</em>s and an <em>Image View</em> to the cell to lay it out as shown below. Once done, save the file as <em>DVDListingView</em>. Make sure to save the file in your project directory and check the checkbox when prompted if you want to add the file into your project.</p>
<p><a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial009.jpg"><img class="aligncenter size-medium wp-image-74" title="tutorial009" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial009-300x219.jpg" alt="tutorial009" width="300" height="219" /></a></p>
<h3>3. Prepare the RootViewController</h3>
<p>Return back to Xcode and open up your <em>RootViewController.h</em> header file. We will add a cell instance variable of type DVDListingViewCell that we&#8217;ve created earlier. We will use this cell to actually draw on the screen. Modify your header file to make it look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@interface</span> RootViewController <span style="color: #002200;">:</span> UITableViewController <span style="color: #002200;">&#123;</span>
    DvdLibraryDao <span style="color: #002200;">*</span>dao;
&nbsp;
    IBOutlet DVDListingViewCell <span style="color: #002200;">*</span>_cell;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>You may notice the IBOutlet annotation again. That is because we will be connecting this variable to the actual cell we created in Interface Builder.</p>
<p>Let&#8217;s switch to the implementation file of our RootViewController (<em>RootViewController.m</em>). You may remember the method <em>cellForRowAtIndexPath</em> from the <a href="http://www.iphonedevcentral.com/?p=15" target="_self">first tutorial</a>. That&#8217;s the method that controls what cell is drawn at which row. We&#8217;ll want our cell to be a <em>DVDListingViewCell</em> so let&#8217;s modify the current version of it to this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>UITableViewCell <span style="color: #002200;">*</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 cellForRowAtIndexPath<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>
&nbsp;
    <span style="color: #a61390;">static</span> <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>CellIdentifier <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;LibraryListingCell&quot;</span>;
&nbsp;
    DVDListingViewCell <span style="color: #002200;">*</span>cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>DVDListingViewCell <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#91;</span>tableView dequeueReusableCellWithIdentifier<span style="color: #002200;">:</span>CellIdentifier<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>cell <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSBundle</span> mainBundle<span style="color: #002200;">&#93;</span> loadNibNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;DVDListingView&quot;</span> owner<span style="color: #002200;">:</span>self options<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
        cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>_cell autorelease<span style="color: #002200;">&#93;</span>;
        _cell <span style="color: #002200;">=</span> <span style="color: #a61390;">nil</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
    cell.titleLabel.text <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>;
    cell.featureLengthLabel.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><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;featureLength&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    cell.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><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;coverImage&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #a61390;">return</span> cell;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>There are few things going on so let&#8217;s analyze them line by line.</p>
<p><em>Line #5</em> was changed to initialize the <em>cell</em> local variable to the <em>DVDListingViewCell</em> instead of the generic <em>UITableViewCell</em>.</p>
<p><em>Lines #6-#10</em> contain the meat of the cell creation. It first loads the <em>nib</em> file we created. You can see we&#8217;re setting the <em>owner</em> to <em>self</em>. That is because the <em>_cell</em> instance variable will get initialized via the <em>nib</em> file, which I&#8217;m going to cover a little later.</p>
<p>And finally, <em>Lines #12-#15</em> assign proper values to the labels and image view in our custom cell.</p>
<h3>4. Connect everything in Interface Builder</h3>
<p>Return back to Interface Builder and click on the <em>File&#8217;s Owner</em> icon. Open up the <em>Identity Inspector</em> (Tools -&gt; Identity Inspector) and look at the <em>Class</em> drop-down menu. Locate <em>RootViewController</em> and select it. In the same window, you should now see the <em>_cell</em> instance variable that belongs to <em>RootViewController</em>. When the nib file is loaded, we&#8217;ll want the cell we designed in Interface Builder to be assigned to our <em>_cell</em>. Let&#8217;s do that next.</p>
<p>Open up <em>Connections Inspector</em> (Tools -&gt; Connections Inspector) with <em>File&#8217;s Owner</em> icon still selected. You should see our <em>_cell</em> in the <em>Outlets</em> section. Next to it is a little hollow circle that turns into a plus (+) sign when you hover it. Click on the circle and drag over to the <em>Listing View Cell</em> window. When you drag over it, the cell should highlight with a label that says &#8220;Listing View Cell.&#8221; Release the mouse to complete the connection (the cell will blink).</p>
<p><a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial010.jpg"><img class="aligncenter size-medium wp-image-88" title="tutorial010" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial010-287x300.jpg" alt="tutorial010" width="287" height="300" /></a></p>
<p><em>Note: There is an alternate way of creating the connection; Click on the File Owner&#8217;s icon while pressing down the Control key and Ctrl-drag to the Listing View Cell icon. A little black pop-up window &#8220;Outlets&#8221; will appear. Select _cell and let go of the mouse.</em></p>
<p><img class="aligncenter size-full wp-image-89" title="tutorial011" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial011.jpg" alt="tutorial011" width="334" height="354" /></p>
<p>Now let&#8217;s connect our two labels and the image view. Highlight the <em>Listing View Icon</em> and open up <em>Identity Inspector</em> (Command+4). Under the <em>Class</em> drop-down find and select our <em>DVDListingViewCell</em>. Once done, you should see all the outlets we defined earlier in the <em>DVDListingViewCell</em> class: <em>coverImageView</em>, <em>featureLengthLabel</em> and <em>titleLabel</em>. Open up <em>Connections Inspector</em> (Command+2) and check out the <em>Outlets</em> section. Just as before, drag a connection from the hollow circle next to <em>titleLabel</em> to the &#8220;My DVD&#8221; label, <em>featureLengthLabel</em> to the feature length label and finally <em>coverImageView</em> to the <em>UIImageView</em> object in our <em>Listing View Cell</em>.</p>
<p><a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial012.jpg"><img class="aligncenter size-medium wp-image-90" title="tutorial012" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial012-279x300.jpg" alt="tutorial012" width="279" height="300" /></a></p>
<p><em>Alternatively, you can Control-drag from the Listing View Cell icon to the Listing View Cell window and connect the three objects that way. </em></p>
<p><img class="aligncenter size-full wp-image-91" title="tutorial013" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial013.jpg" alt="tutorial013" width="346" height="670" />Save all your changes and return back to Xcode.</p>
<h3>5. Set the cell height in RootViewController</h3>
<p>After you&#8217;ve saved your changes in Interface Builder and return back to Xcode, go ahead and run the project. You&#8217;ll see that everything works well except one thing &#8211; the cells are all crammed together.</p>
<p><a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial014.jpg"><img class="aligncenter size-medium wp-image-93" title="tutorial014" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial014-161x300.jpg" alt="tutorial014" width="161" height="300" /></a></p>
<p>This is because we need to explicitly set the height of cells in each row when it differs from the default. We can correct that by implementing the <em>heightForRowAtIndexPath</em> delegate method in the <em>RootViewController.m</em> file.</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>CGFloat<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 heightForRowAtIndexPath<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>
    <span style="color: #a61390;">return</span> <span style="color: #2400d9;">120.0</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Rerun your project and you should now see the cells correctly sized and looking good.</p>
<p><a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial0061.jpg"><img class="aligncenter size-medium wp-image-94" title="tutorial006" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial0061-161x300.jpg" alt="tutorial006" width="161" height="300" /></a></p>
<h3>Conclusion</h3>
<p>Remember that this is just one of a couple ways to customize your cells. You can do all of this by hand, programmatically which is more work but may result in a better performance. We will cover that in the second part of this tutorial.</p>
<p>You can download the complete source code to this tutorial here: <a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/MyDVDLibrary02.zip">My DVD Library Xcode Project 02</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonedevcentral.com/customize-that-uiviewcell-part-1-using-interface-builder/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Hello UITableView!</title>
		<link>http://www.iphonedevcentral.com/hello-uitableview/</link>
		<comments>http://www.iphonedevcentral.com/hello-uitableview/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 05:50:25 +0000</pubDate>
		<dc:creator>Vladimir Olexa</dc:creator>
				<category><![CDATA[sdk]]></category>

		<guid isPermaLink="false">http://www.iphonedevcentral.com/?p=15</guid>
		<description><![CDATA[Ok, let&#8217;s start with something really simple. We&#8217;ll be creating an app to keep track of your DVD library. The app will have a table view, a detail view and some basic navigational components.
Pre-requisites
I assume you have Xcode and iPhone SDK 3.x already installed (I&#8217;m using version Xcode 3.1, with 3.2 being the newest at the [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, let&#8217;s start with something really simple. We&#8217;ll be creating an app to keep track of your DVD library. The app will have a table view, a detail view and some basic navigational components.</p>
<h3><strong>Pre-requisites</strong></h3>
<p>I assume you have <a title="Xcode" href="http://developer.apple.com/tools/xcode/index.html" target="_blank" onclick="urchinTracker('/outgoing/developer.apple.com/tools/xcode/index.html?referer=');">Xcode</a> and <a href="http://developer.apple.com/iphone/" target="_blank" onclick="urchinTracker('/outgoing/developer.apple.com/iphone/?referer=');">iPhone SDK 3.x</a> already installed (I&#8217;m using version Xcode 3.1, with 3.2 being the newest at the time of this writing). I also assume you know how to create a project so I&#8217;m not going to cover those little things here. Lastly, I assume you have some knowledge <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html" target="_blank" onclick="urchinTracker('/outgoing/developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html?referer=');">Objective-C</a>, its principles, syntax and paradigms.</p>
<h3><strong>1. Set up your project</strong></h3>
<p>Create a &#8220;Navigation-based Application&#8221; and name it &#8220;TableViewApp.&#8221; Right off the bat, you&#8217;ll have an empty app, which is pretty much useless. You can run it using Cmd+R.</p>
<h3><strong>2. Create a dummy data set</strong></h3>
<p>Right-click on the <em>Resources</em> folder and choose <em>Add -&gt; New File. </em>Under <em>Other </em>category, choose <em>Property List</em>. Name it <em>TestData.plist. </em>This is basically an XML file that will have an empty Dictionary in it by default. Change <em>Dictionary</em> to <em>Array</em> since we&#8217;re going to be adding numerous &#8220;DVDs&#8221; which will be described as individual <em>Dictionaries</em>.</p>
<p><img class="aligncenter size-full wp-image-20" title="tutorial001" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial0012.jpg" alt="tutorial001" width="677" height="68" /></p>
<p style="text-align: center;">
<p style="text-align: left;">You can add data to it by simply clicking the little button to the right of the <em>Value </em>column. We will be adding information about your DVD collection to it so the schema of your data set could be something like this:</p>
<ul>
<li><em>Title &#8211; String</em></li>
<li><em>Cover image &#8211; String</em></li>
<li><em>Feature length  - Number (in minutes)</em></li>
<li><em>Release date &#8211; Date</em></li>
</ul>
<p style="text-align: left;">Of course, this could be extended to more fields such as director, genre, aspect ratio, etc.</p>
<p style="text-align: left;">Following this schema, add a few items to your dummy data set. You&#8217;ll eventually want to have your file looking something like this:</p>
<p style="text-align: left;"><img class="aligncenter size-full wp-image-21" title="tutorial002" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial002.jpg" alt="tutorial002" width="644" height="337" /></p>
<p style="text-align: left;">If you don&#8217;t feel like typing all this info in, you can download the file here: <a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/TestData.plist">TestData.plist</a>.</p>
<p><span id="more-15"></span></p>
<h3><strong>3. Create a DAO (Data Access Object) to access your data</strong></h3>
<p style="text-align: left;">Right-click on the <em>Classes</em> folder and choose <em>Add -&gt; New File</em>. Under <em>Cocoa Touch Class </em>category choose <em>Objective-C class</em>. Name it <em>DvdLibraryDao</em>.</p>
<p style="text-align: left;">This will be a very simple class that will take our dummy data file, read it in as a <em>NSArray</em> and provide some utility methods to access the data from the file.</p>
<p style="text-align: left;">First, let&#8217;s define our custom init method and some instance variables that will be needed for our implementation.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Gets a plist name and reads in its contents as an array</span>
<span style="color: #a61390;">@interface</span> DvdLibraryDao <span style="color: #002200;">:</span> <span style="color: #400080;">NSObject</span> <span style="color: #002200;">&#123;</span>
    <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>libraryPlist;
    <span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>libraryContent;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, readonly<span style="color: #002200;">&#41;</span> <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>libraryPlist;
<span style="color: #a61390;">@property</span> <span style="color: #002200;">&#40;</span>nonatomic, readonly<span style="color: #002200;">&#41;</span> <span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>libraryContent;
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithLibraryName<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>libraryName;
<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>libraryItemAtIndex<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>index;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>libraryCount;
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p style="text-align: left;">Next we create a custom initialization method, which will give us the name of the property list we want to read in. This code goes in your <em>DvdLibraryDao.m</em> file.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Gets a plist name and reads in its contents as an array</span>
 <span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithLibraryName<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>libraryName <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>
        libraryPlist <span style="color: #002200;">=</span> libraryName;
        libraryContent <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSArray</span> alloc<span style="color: #002200;">&#93;</span> initWithContentsOfFile<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSBundle</span> mainBundle<span style="color: #002200;">&#93;</span>
                                                                  pathForResource<span style="color: #002200;">:</span>libraryPlist ofType<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;plist&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">return</span> self;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p style="text-align: left;">To retrieve information about a particular DVD, we&#8217;ll want a method that would access our array at a requested index and then returns the <em>NSDictionary</em> that contains the data we&#8217;re after. Add this method to <em>DvdLibraryDao.m.</em></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// [Safely] returns a &quot;DVD&quot; from the plist. Each item in the data source is a dictionary containing data about</span>
<span style="color: #11740a; font-style: italic;">// the chosen DVD.</span>
<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>libraryItemAtIndex<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>index <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#40;</span>libraryContent <span style="color: #002200;">!=</span> <span style="color: #a61390;">nil</span> <span style="color: #002200;">&amp;</span>amp;<span style="color: #002200;">&amp;</span>amp; <span style="color: #002200;">&#91;</span>libraryContent count<span style="color: #002200;">&#93;</span> <span style="color: #002200;">&amp;</span>gt; <span style="color: #2400d9;">0</span> <span style="color: #002200;">&amp;</span>amp;<span style="color: #002200;">&amp;</span>amp; index <span style="color: #002200;">&amp;</span>lt; <span style="color: #002200;">&#91;</span>libraryContent count<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
        ? <span style="color: #002200;">&#91;</span>libraryContent objectAtIndex<span style="color: #002200;">:</span>index<span style="color: #002200;">&#93;</span>
        <span style="color: #002200;">:</span> <span style="color: #a61390;">nil</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p style="text-align: left;">The last method simply returns the count of DVDs in our data file.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Returns the count of all DVDs in our library</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>libraryCount <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#40;</span>libraryContent <span style="color: #002200;">!=</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> ? <span style="color: #002200;">&#91;</span>libraryContent count<span style="color: #002200;">&#93;</span> <span style="color: #002200;">:</span> <span style="color: #2400d9;">0</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<h3><em><span style="font-style: normal;"><strong>4. Make your Table View read from the DAO</strong></span></em></h3>
<p style="text-align: left;"><em><span style="font-style: normal;">Now that we have a data source, let&#8217;s make our table read from it. </span></em></p>
<p style="text-align: left;">Add an instance variable to your <em>RootViewController.h</em> called <em>dao</em> of type <em>DvdLibraryDao.</em></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &quot;DvdLibraryDao.h&quot;</span>
&nbsp;
<span style="color: #a61390;">@interface</span> RootViewController <span style="color: #002200;">:</span> UITableViewController <span style="color: #002200;">&#123;</span>
    DvdLibraryDao <span style="color: #002200;">*</span>dao;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p style="text-align: left;">We&#8217;ll initialize this variable in the <em>viewWillAppear</em> method that can be found in the implementation file of <em>RootViewController</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;">void</span><span style="color: #002200;">&#41;</span>viewWillAppear<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>animated <span style="color: #002200;">&#123;</span>
    dao <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>DvdLibraryDao alloc<span style="color: #002200;">&#93;</span> initWithLibraryName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;TestData&quot;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p style="text-align: left;"><em>TestData</em> here is the name of the plist containing our data we created earlier.</p>
<p style="text-align: left;">To tell our table how many rows it has, we override the delegate method of <em>UITableView</em> called <em>numberOfRowsInSection</em>. All this method does is it returns the number of rows there are in the current section. We&#8217;ll cover sections later.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Customize the number of rows in the table view.</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>NSInteger<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 numberOfRowsInSection<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>section <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>dao libraryCount<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p style="text-align: left;">We&#8217;re calling the <em>libraryCount</em> method we&#8217;ve implemented earlier to get the number of DVDs in our library.</p>
<p style="text-align: left;">In the last step before we can run this project and see our records in the table, we tell the table what to display at each row. We do this in the delegate method <em>cellForRowAtIndexPath. </em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Customize the appearance of table view cells.</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>UITableViewCell <span style="color: #002200;">*</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 cellForRowAtIndexPath<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>
&nbsp;
    <span style="color: #a61390;">static</span> <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>CellIdentifier <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;LibraryListingCell&quot;</span>;
&nbsp;
    UITableViewCell <span style="color: #002200;">*</span>cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>tableView dequeueReusableCellWithIdentifier<span style="color: #002200;">:</span>CellIdentifier<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>cell <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UITableViewCell alloc<span style="color: #002200;">&#93;</span> initWithStyle<span style="color: #002200;">:</span>UITableViewCellStyleDefault
                                       reuseIdentifier<span style="color: #002200;">:</span>CellIdentifier<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
	cell.textLabel.text <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>;
&nbsp;
    <span style="color: #a61390;">return</span> cell;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p style="text-align: left;">One note about line #4 that might not be so obvious  - <em>static NSString *CellIdentifier = @&#8221;LibraryListingCell&#8221;</em>. Since tables can potentially have thousands of rows, the system memory consumed by creating all the rows at once would in the best case considerably slow down your table&#8217;s performance and in the worst case crash your application.</p>
<p style="text-align: left;">That&#8217;s why Apple introduced the concept of cell reuse. Behind the scenes, the system only creates the visible cells (and some) and as you start scrolling, it reuses the cells that are currently off screen to display the content that is on screen. By giving a cell an identifier, you&#8217;re basically marking it to be reused over and over again in your view instead of continuously creating new cells.</p>
<h3>5. Add a title to the header</h3>
<p>To add a title to the header of the table view, we simply add this line to the <em>viewWillAppear</em> method we overrode earlier.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">    self.title <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;My DVD Library&quot;</span>;</pre></div></div>

<h3><strong>6. See what it looks like so far</strong></h3>
<p style="text-align: left;">Run your project (in the simulator or on the device) and if everything is wired correctly, you should see something like this:</p>
<p style="text-align: left;"><a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial0031.jpg"><img class="aligncenter size-full wp-image-39" title="tutorial003" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial0031.jpg" alt="tutorial003" width="414" height="770" /></a></p>
<p style="text-align: left;">
<h3>7. Create the Detail View</h3>
<p style="text-align: left;">After a user selects one of the rows, we want them to go to a detail page where more information about the DVD is shown. We could simply use a <em>UIView</em> and add a bunch of <em>UILable</em>s to it to achieve this but since we&#8217;re covering <em>UITableView</em> in this tutorial, we&#8217;ll create another table.</p>
<p style="text-align: left;"><em>(Note that this NOT how you&#8217;d want do it in a real-life app. I&#8217;m showing it strictly to demonstrate a grouped style table.)</em></p>
<p style="text-align: left;">Right-click on the <em>Classes</em> folder and choose <em>Add -&gt; New File</em> again.  From <em>Cocoa Touch Class</em> category pick the <em>Objective-C class</em> and then choose <em>UITableViewController</em> from the subclass dropdown menu in the lower half of the window. This is different in Xcode 3.1 from previous versions where <em>UITableViewController</em> was simply a part of the presented classes. Name the file <em>DetailViewController.</em></p>
<p style="text-align: left;">
<p style="text-align: left;"><img class="aligncenter size-full wp-image-43" title="tutorial004" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial0042.jpg" alt="tutorial004" width="609" height="477" /></p>
<p style="text-align: left;">There are few things we need to do here. We&#8217;ll need some place to hold values of the labels used to describe our fields and also the actual values of the fields. For that, let&#8217;s create two instance variables of type <em>NSMutableArray</em> which we&#8217;ll later fill with appropriate data.</p>
<p style="text-align: left;">To properly initialize our data in the detail view, we&#8217;ll also need a custom init method. It is a modified version of <em>initWithStyle</em> that comes by default with <em>UITableViewController</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> UITableViewController <span style="color: #002200;">&#123;</span>
    <span style="color: #400080;">NSMutableArray</span> <span style="color: #002200;">*</span>labels;
    <span style="color: #400080;">NSMutableArray</span> <span style="color: #002200;">*</span>values;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithStyle<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableViewStyle<span style="color: #002200;">&#41;</span>style andDvdData<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;
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p style="text-align: left;">Let&#8217;s implement our custom init 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>initWithStyle<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableViewStyle<span style="color: #002200;">&#41;</span>style andDvdData<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 <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 initWithStyle<span style="color: #002200;">:</span>style<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        labels <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableArray</span> new<span style="color: #002200;">&#93;</span>;
        values <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableArray</span> new<span style="color: #002200;">&#93;</span>;
&nbsp;
        <span style="color: #11740a; font-style: italic;">// Set up labels which will become header titles</span>
        <span style="color: #002200;">&#91;</span>labels addObject<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>labels addObject<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Release Date&quot;</span><span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>labels addObject<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Length&quot;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
        <span style="color: #11740a; font-style: italic;">// Add now the values that correspond to each label</span>
        <span style="color: #002200;">&#91;</span>values addObject<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><span style="color: #002200;">&#93;</span>;
        <span style="color: #11740a; font-style: italic;">// We're faking formatting of date and length here simply dumping them as objects.</span>
        <span style="color: #11740a; font-style: italic;">// We should really convert the values to proper data types and then display them as strings.</span>
        <span style="color: #002200;">&#91;</span>values addObject<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><span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>values addObject<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><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">return</span> self;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p style="text-align: left;">Each table header will display the label of our field (e.g.Title or Release Date). To do that, we&#8217;ll override <em>UITableView</em>&#8217;s delegate method <em>titleForHeaderInSection</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: #400080;">NSString</span> <span style="color: #002200;">*</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>aTableView titleForHeaderInSection<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>section <span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>labels objectAtIndex<span style="color: #002200;">:</span>section<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p style="text-align: left;">Now we need to handle header and row counts as well as displaying actual values in our table rows.</p>
<p style="text-align: left;">The number of headers would correspond to the number of labels we want to display.</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>NSInteger<span style="color: #002200;">&#41;</span>numberOfSectionsInTableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>labels count<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p style="text-align: left;">We&#8217;re going to cheat a little bit here. As I mentioned previously, a table view isn&#8217;t exactly the best choice to display this kind of data. The reason we&#8217;re going to return <em>1</em> as number of rows per section is because if we set it to the count of values, we would get duplicate values per each section. Instead of leaving the value as <em>1</em>, try setting it to <em>[values count]</em> and see what I mean.</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>NSInteger<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 numberOfRowsInSection<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>NSInteger<span style="color: #002200;">&#41;</span>section <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">return</span> <span style="color: #2400d9;">1</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p style="text-align: left;">Finally, we set the cell textual value to each corresponding field.</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>UITableViewCell <span style="color: #002200;">*</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 cellForRowAtIndexPath<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>
&nbsp;
    <span style="color: #a61390;">static</span> <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>CellIdentifier <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;DetailViewCell&quot;</span>;
&nbsp;
    UITableViewCell <span style="color: #002200;">*</span>cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>tableView dequeueReusableCellWithIdentifier<span style="color: #002200;">:</span>CellIdentifier<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>cell <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UITableViewCell alloc<span style="color: #002200;">&#93;</span> initWithStyle<span style="color: #002200;">:</span>UITableViewCellStyleDefault
                                       reuseIdentifier<span style="color: #002200;">:</span>CellIdentifier<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
    cell.textLabel.text <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>values objectAtIndex<span style="color: #002200;">:</span>indexPath.section<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #a61390;">return</span> cell;
<span style="color: #002200;">&#125;</span></pre></div></div>

<h3>8. Modify <em>RootViewController</em> to handle <em>DetailViewController</em></h3>
<p style="text-align: left;">As the last step, we&#8217;ll need to tell <em>RootViewController</em> to actually display <em>DetailViewController</em> when a row is pressed. We do that in the <em>didSelectRowAtIndexPath </em>delegate method.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Override to support row selection in the table view.</span>
<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>
    <span style="color: #11740a; font-style: italic;">// UITableViewStyleGrouped table view style will cause the table have a textured background</span>
    <span style="color: #11740a; font-style: italic;">// and each section will be separated from the other ones.</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>
                                        initWithStyle<span style="color: #002200;">:</span>UITableViewStyleGrouped
                                        andDvdData<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 style="text-align: left;">One more detail. When we return back to RootViewController from DetailViewController, we&#8217;ll want to deselect the row that had been pressed. To do so, we modify the <em>viewWillAppear </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;">void</span><span style="color: #002200;">&#41;</span>viewWillAppear<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>animated <span style="color: #002200;">&#123;</span>
    dao <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>DvdLibraryDao alloc<span style="color: #002200;">&#93;</span> initWithLibraryName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;TestData&quot;</span><span style="color: #002200;">&#93;</span>;
    self.title <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;My DVD Library&quot;</span>;
    <span style="color: #002200;">&#91;</span>self.tableView deselectRowAtIndexPath<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>self.tableView indexPathForSelectedRow<span style="color: #002200;">&#93;</span> animated<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p style="text-align: left;">If everything went well, re-running the project and tapping on one of the rows should show you the detail view table that should look like this:</p>
<p style="text-align: left;"><img class="aligncenter size-full wp-image-47" title="tutorial005" src="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/tutorial005.jpg" alt="tutorial005" width="414" height="770" /></p>
<p style="text-align: left;">
<h3>Conclusion</h3>
<p>Hopefully this tutorial has given you a good starting point for creating your own app. The next steps could be replacing the static plist file with a Core Data store or maybe pull the data from a remote XML file. Also, the DetailViewController should really be a subclass of UIView that would provide a lot more flexibility in laying out your data.</p>
<p>You can download a finished version of this project here: <a href="http://www.iphonedevcentral.com/wp-content/uploads/2009/07/MyDVDLibrary01.zip">My DVD Library Xcode Project</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonedevcentral.com/hello-uitableview/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>iPhone SDK, at last&#8230;</title>
		<link>http://www.iphonedevcentral.com/iphone-sdk-at-last/</link>
		<comments>http://www.iphonedevcentral.com/iphone-sdk-at-last/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 22:56:42 +0000</pubDate>
		<dc:creator>Vladimir Olexa</dc:creator>
				<category><![CDATA[sdk]]></category>

		<guid isPermaLink="false">http://www.iphonedevcentral.com/?p=6</guid>
		<description><![CDATA[Apple has finally released their SDK today. A week behind the schedule but at least it&#8217;s here.
Along with this announcement came another one. Enterprise services are getting a huge boost by supporting the push technology, Cisco IPSec VPN, Certificates and Identities or WPA2, among others. However, the biggest one is support for Active Sync and [...]]]></description>
			<content:encoded><![CDATA[<p>Apple has finally released their SDK today. A week behind the schedule but at least it&#8217;s here.</p>
<p>Along with this announcement came another one. Enterprise services are getting a huge boost by supporting the push technology, Cisco IPSec VPN, Certificates and Identities or WPA2, among others. However, the biggest one is support for Active Sync and Microsoft Exchange. These new enterprise features will be available via June&#8217;s software update (free for iPhone, paid for iPod touch) and is also available in <a href="http://www.macrumors.com/c.php?u=http%3A%2F%2Fwww.apple.com%2Fiphone%2Fenterprise%2F&#038;t=1204842302" target="_blank" onclick="urchinTracker('/outgoing/www.macrumors.com/c.php?u=http_3A_2F_2Fwww.apple.com_2Fiphone_2Fenterprise_2F_038_t=1204842302&amp;referer=');">beta</a> for US-based businesses that qualify.</p>
<p>The <a href="http://developer.apple.com/iphone/sdk1/" target="_blank" onclick="urchinTracker('/outgoing/developer.apple.com/iphone/sdk1/?referer=');">SDK</a> is now available for <a href="http://developer.apple.com/iphone/sdk1/" target="_blank" onclick="urchinTracker('/outgoing/developer.apple.com/iphone/sdk1/?referer=');">download</a> on <a href="http://developer.apple.com" target="_blank" onclick="urchinTracker('/outgoing/developer.apple.com?referer=');">ADC</a>. </p>
<p>The technologies used in the SDK are divided into these layers:</p>
<ul>
<li>Cocoa Mutlitouch</li>
<li>Media</li>
<li>Core Services</li>
<li>Core OS</li>
</ul>
<h2>Cocoa Touch</h2>
<p>Cocoa Touch layer lets you access technologies such as Multi-touch events, Multi-touch controls, Acceleromter, View Hierarchy, Localization, Alerts, Web View, People Picker, Image Picker or Camera</p>
<h2>Media</h2>
<p>This one will probably get the most attention. Especially with combination with Cocoa Touch. You get your hands on Core Audio, OpenAL, Audio Mixing, Audio Recording, Video Playback, JPG, PNG, TIFF, PDS Quartz, Core Animation and Embedded OpenGL</p>
<h2>Core Services</h2>
<p>Core services is more lower-level oriented and will make a lot of sense for business-like apps. It includes Collections, Address Book, Networking, File access, SQLite, Core Location, Net Services Threading, Preferences, URL utilities</p>
<h2>Core OS</h2>
<p>And finally, the OS layer lets you really optimize you app by talking to low-level services such as OS X Kernel, BSD TCP/IP, Sockets, Power Management, Keychain, Certificates, File System, Lib System, Security, Bonjour</p>
<h2>Requirements and what you&#8217;ll get</h2>
<p>You will need to have Leopard 10.2 installed on an Intel machine to use the SDK. It comes complete with enhanced Xcode and an iPhone emulator. I just downloaded it (their site is currently very slow) and will be trying it out. I will write up a post once I play with it a bit. I&#8217;m so excited, YAY!! <img src='http://www.iphonedevcentral.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonedevcentral.com/iphone-sdk-at-last/feed/</wfw:commentRss>
		<slash:comments>0</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>
