<?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>Chewy Apps &#187; Development Tips</title>
	<atom:link href="http://www.chewyapps.com/category/all-blog-posts/development-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chewyapps.com</link>
	<description>Hi, I&#039;m Henning, and I&#039;m an iPhone developer.</description>
	<lastBuildDate>Sat, 28 Jan 2012 19:00:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Removing pesky UITableView lines</title>
		<link>http://www.chewyapps.com/2012/01/28/removing-pesky-uitableview-lines/</link>
		<comments>http://www.chewyapps.com/2012/01/28/removing-pesky-uitableview-lines/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 19:00:22 +0000</pubDate>
		<dc:creator>henning</dc:creator>
				<category><![CDATA[Development Tips]]></category>

		<guid isPermaLink="false">http://www.chewyapps.com/?p=563</guid>
		<description><![CDATA[You know how, if you have a UITableView with only a few entries, how the divider lines for the empty (non-existent) cells still show up? This happens to me every once in a while, and every time I always have to go look up the solution. Well in case you&#8217;re wondering, it&#8217;s as easy as [...]]]></description>
			<content:encoded><![CDATA[<p>You know how, if you have a UITableView with only a few entries, how the divider lines for the empty (non-existent) cells still show up? This happens to me every once in a while, and every time I always have to go look up the solution. Well in case you&#8217;re wondering, it&#8217;s as easy as one line of code:</p>
<p><em>mTableView.tableFooterView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];</em></p>
<p>And that&#8217;s it. Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chewyapps.com/2012/01/28/removing-pesky-uitableview-lines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slide-Away Screens</title>
		<link>http://www.chewyapps.com/2012/01/24/slide-away-screens/</link>
		<comments>http://www.chewyapps.com/2012/01/24/slide-away-screens/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 13:34:03 +0000</pubDate>
		<dc:creator>henning</dc:creator>
				<category><![CDATA[Development Tips]]></category>

		<guid isPermaLink="false">http://www.chewyapps.com/?p=556</guid>
		<description><![CDATA[In an app I&#8217;m working on now I thought I&#8217;d give the slide-away screen metaphor a try. Like the one found in the Path and Facebook apps. So I went online and sought a library that could do that for me. Many of the libraries I found were actually for the iPad, and mimicked the [...]]]></description>
			<content:encoded><![CDATA[<p>In an app I&#8217;m working on now I thought I&#8217;d give the slide-away screen metaphor a try. Like the one found in the Path and Facebook apps. So I went online and sought a library that could do that for me. Many of the libraries I found were actually for the iPad, and mimicked the behaviour of the Twitter app. Close, but not what I wanted. I found a few libraries, but many of them didn&#8217;t support swiping. They were only controlled by a button or some other event. </p>
<p>Finally I found <a href="https://github.com/devindoty/DDMenuController" target="_blank">DDMenuController</a>, which seemed to fit what I wanted to do. I experimented with it a bit, and it was easy enough to use. I could also tweak the source code to change how much of the &#8220;underneath&#8221; controller would show. This was important because I only wanted to show a narrow strip of controls, which isn&#8217;t very wide. But soon enough I discovered bugs. Often on a swipe, the underneath controller wouldn&#8217;t show at all, but rather it would just be black. I fiddled with the source code a bit and finally got that to happen a lot less often. But when I added a second underneath controller on the right side, the problem came back with a vengeance, and at that point I just gave up.</p>
<p>I looked around again, and found a library I didn&#8217;t find the first time. It&#8217;s called <a href="https://github.com/Inferis/ViewDeck" target="_blank">ViewDeck</a>. So far, I haven&#8217;t encountered any bugs, which is good. But I haven&#8217;t yet found a way to change how far the main screen moves over. Well, that&#8217;s not quite true. I did find something for that, but when I set it to a value I like, the main screen just bounces back and doesn&#8217;t stay in the slid-over position. So I&#8217;m going to play around with it a little bit and post an update with what I found.</p>
<p><strong>UPDATE 1:</strong> I found the solution. It&#8217;s just a matter of making sure the rightLedge is large enough to trigger the left edge to stay in place. I&#8217;m hoping this works out later when I&#8217;ll want a small left underneath view and a large right underneath view.</p>
<p><strong>UPDATE 2:</strong> As it turns out, trying to have a large right view <strong>was</strong> problematic. But I changed the source code to fix that. In <em>(void)panned:(UIPanGestureRecognizer*)panner</em> there&#8217;s a divsion by 3.0. I changed that to 4.0 and that made it work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chewyapps.com/2012/01/24/slide-away-screens/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove Tab Bar When Controller Pushed</title>
		<link>http://www.chewyapps.com/2011/07/21/remove-tab-bar-when-controller-pushed/</link>
		<comments>http://www.chewyapps.com/2011/07/21/remove-tab-bar-when-controller-pushed/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 12:25:17 +0000</pubDate>
		<dc:creator>henning</dc:creator>
				<category><![CDATA[Development Tips]]></category>

		<guid isPermaLink="false">http://www.chewyapps.com/?p=464</guid>
		<description><![CDATA[Sometimes it&#8217;s the little tips that prove really useful, and as such, I present one today. This would have helped me out greatly about three months ago. If you have a UITabBarController, and you&#8217;re pushing a new controller in a UINavigationController which is one of the tabs, typically the tab bar across the bottom stays [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes it&#8217;s the little tips that prove really useful, and as such, I present one today. This would have helped me out greatly about three months ago. If you have a UITabBarController, and you&#8217;re pushing a new controller in a UINavigationController which is one of the tabs, typically the tab bar across the bottom stays in place. But you can remove it quite easily with this line of code:</p>
<div class="codesnip-container" >controller.hidesBottomBarWhenPushed = YES;  // yay! this hides the tab bar!<br />
[self.navigationController pushViewController:controller animated:YES];</div>
<p>I just discovered this recently, and have already made use of it. Good luck.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chewyapps.com/2011/07/21/remove-tab-bar-when-controller-pushed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pattern for Loading Table Data</title>
		<link>http://www.chewyapps.com/2011/02/28/pattern-for-loading-table-data/</link>
		<comments>http://www.chewyapps.com/2011/02/28/pattern-for-loading-table-data/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 13:18:22 +0000</pubDate>
		<dc:creator>henning</dc:creator>
				<category><![CDATA[Development Tips]]></category>

		<guid isPermaLink="false">http://www.chewyapps.com/?p=423</guid>
		<description><![CDATA[I gave this pattern to a coworker of mine the other day, and they thought it was quite helpful. Starting iPhone develops may be just getting used to how things work on the iPhone, so I thought I&#8217;d point out a good way to load a lot of data into a table view. - (void) [...]]]></description>
			<content:encoded><![CDATA[<p>I gave this pattern to a coworker of mine the other day, and they thought it was quite helpful. Starting iPhone develops may be just getting used to how things work on the iPhone, so I thought I&#8217;d point out a good way to load a lot of data into a table view.</p>
<div class="codesnip-container" >- (void) finishStartup<br />
{<br />
     // this must be done on main thread<br />
     // stop spinner here using self.view<br />
     [mTableView reloadData];<br />
}</p>
<p>- (void) startup<br />
{<br />
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];</p>
<p>     // load the data here</p>
<p>     [pool release];</p>
<p>     [self performSelectorOnMainThread:@selector(finishStartup) withObject:nil waitUntilDone:NO];<br />
}</p>
<p>- (void)viewDidLoad {<br />
     [super viewDidLoad];<br />
     // start spinner here using self.view<br />
     [self performSelectorInBackground:@selector(startup) withObject:nil];<br />
}</p></div>
<p>You have to remember that GUI stuff like starting and stopping spinners and reloading the table view have to be done on the main thread. </p>
<p>You can&#8217;t just do something like this:</p>
<div class="codesnip-container" >- (void)viewDidLoad {<br />
     [super viewDidLoad];<br />
     // start spinner here using self.view<br />
     // load data<br />
     // stop spinner<br />
     [mTableView reloadData];<br />
}</div>
<p>Why? Because the spinner never gets a chance to be processed and shown. That&#8217;s a general pattern whenever you want to show the spinner. You have to start it in the main thread and do your processing independently.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chewyapps.com/2011/02/28/pattern-for-loading-table-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom Button in NavBar</title>
		<link>http://www.chewyapps.com/2010/04/23/custom-button-in-navbar/</link>
		<comments>http://www.chewyapps.com/2010/04/23/custom-button-in-navbar/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 14:26:15 +0000</pubDate>
		<dc:creator>henning</dc:creator>
				<category><![CDATA[Development Tips]]></category>

		<guid isPermaLink="false">http://www.chewyapps.com/?p=367</guid>
		<description><![CDATA[Just a quick snippet of code for you guys today. Ever wanted to know how to put a custom image into the navigation bar? It&#8217;s actually pretty easy. Create a UIButton object, and stick that into the UIBarButtonItem object. The trick is to remember to set the size: UIButton *add = [UIButton buttonWithType:UIButtonTypeCustom]; image = [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick snippet of code for you guys today. </p>
<p>Ever wanted to know how to put a custom image into the navigation bar? It&#8217;s actually pretty easy. Create a UIButton object, and stick that into the UIBarButtonItem object. The trick is to remember to set the size:</p>
<div class="codesnip-container" >UIButton *add = [UIButton buttonWithType:UIButtonTypeCustom];</p>
<p>	image = [UIImage imageNamed:@"button_plus.png"];<br />
	[add setImage:image forState:UIControlStateNormal];<br />
	image = [UIImage imageNamed:@"button_plus_selected.png"];<br />
	[add setImage:image forState:UIControlStateSelected];</p>
<p>	add.bounds = CGRectMake(0, 0, image.size.width, image.size.height);<br />
	[add addTarget:self action:@selector(onAdd) forControlEvents:UIControlEventTouchUpInside];</p>
<p>	addButton = [[UIBarButtonItem alloc] initWithCustomView:add];<br />
    self.navigationItem.rightBarButtonItem = addButton;</p></div>
<p>And Bob&#8217;s your uncle!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chewyapps.com/2010/04/23/custom-button-in-navbar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone QRCode Integration</title>
		<link>http://www.chewyapps.com/2010/04/19/iphone-qrcode-integration/</link>
		<comments>http://www.chewyapps.com/2010/04/19/iphone-qrcode-integration/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 19:16:36 +0000</pubDate>
		<dc:creator>henning</dc:creator>
				<category><![CDATA[Development Tips]]></category>
		<category><![CDATA[barcode]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[QRCode]]></category>

		<guid isPermaLink="false">http://www.chewyapps.com/?p=364</guid>
		<description><![CDATA[For one of my jobs I had to integrate QRCodes into the app. A QRCode is a 2 dimensional barcode, like you see here: There are several ways of generating QRCodes online, including this one for generating MeCards, and this one for generating text, URL, SMS, and phone number ones. Integrating QRCodes into an iPhone [...]]]></description>
			<content:encoded><![CDATA[<p>For one of my jobs I had to integrate QRCodes into the app. A QRCode is a 2 dimensional barcode, like you see here:</p>
<p><img src="http://www.chewyapps.com/wp-content/uploads/2010/04/qrcode.png" alt="qrcode" title="qrcode" width="376" height="376" class="alignnone size-full wp-image-365" /></p>
<p>There are several ways of generating QRCodes online, including <a href="http://www.quickmark.cn/en/diy/?qrMeCard">this one for generating MeCards</a>, and <a href="http://qrcode.kaywa.com/">this one</a> for generating text, URL, SMS, and phone number ones.</p>
<p>Integrating QRCodes into an iPhone app is pretty easy, because there&#8217;s already an open source project that does it. It&#8217;s called <a href="http://code.google.com/p/zxing/">ZXing (or Zebra Crossing).</a>. It&#8217;s cross platform and includes Android and other versions too. We just need to concern ourselves with the iPhone version.</p>
<p>Included in the project is a bunch of actions too, depending on what is encoded in the QRCode. It&#8217;ll attempt to parse the code and generate an email address or a MeCard or one of several others things as well. All the action happens in the <strong>DecoderViewController</strong> class, and <strong>presentResultForString</strong> is the method you want to look at to see what it does with the results of the image scan.</p>
<p>You can actually use your iPhone to take snapshots of QRCodes right from your computer&#8217;s monitor. I&#8217;ve used this method to test my app, but frankly it&#8217;s not always reliable. As well, it works a lot better with the 3GS camera than the 3G camera, because it&#8217;s just better. <img src='http://www.chewyapps.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.chewyapps.com/2010/04/19/iphone-qrcode-integration/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Fading an Image into Another</title>
		<link>http://www.chewyapps.com/2009/09/14/fading-an-image-into-another/</link>
		<comments>http://www.chewyapps.com/2009/09/14/fading-an-image-into-another/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 12:58:08 +0000</pubDate>
		<dc:creator>henning</dc:creator>
				<category><![CDATA[Development Tips]]></category>

		<guid isPermaLink="false">http://www.chewyapps.com/?p=316</guid>
		<description><![CDATA[My Pollen project required that I be able to have an image, and fade it into another image. Other projects since then have also had similar requirements. The effect is very nice, and the great thing is that the code is really quite simple. Just have two images, and do an animation from one to [...]]]></description>
			<content:encoded><![CDATA[<p>My Pollen project required that I be able to have an image, and fade it into another image. Other projects since then have also had similar requirements. The effect is very nice, and the great thing is that the code is really quite simple. Just have two images, and do an animation from one to the other. I like have one image always being the active one (when not animating), so that&#8217;s how I structured the code below. I assume you have two UIImageView&#8217;s set up named mFrontView and mBackView.</p>
<div class="codesnip-container" >
<div class="c_mac codesnip" style="font-family:monospace;">UIImage <span class="sy0">*</span>newImg <span class="sy0">=</span> <span class="co1">// get new image here;</span><br />
UIImage <span class="sy0">*</span>oldImg <span class="sy0">=</span> mFrontView.<span class="me1">image</span>;</p>
<p><span class="kw1">if</span> <span class="br0">&#40;</span> newImg <span class="sy0">!=</span> oldImg <span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mBackView setImage<span class="sy0">:</span>mFrontView.<span class="me1">image</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; mFrontView.<span class="me1">alpha</span> <span class="sy0">=</span> <span class="nu0">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; mBackView.<span class="me1">alpha</span> <span class="sy0">=</span> <span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mFrontView setImage<span class="sy0">:</span>newImg<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>UIView beginAnimations<span class="sy0">:</span>nil context<span class="sy0">:</span><span class="kw2">NULL</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>UIView setAnimationDuration<span class="sy0">:</span>0.5<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; mFrontView.<span class="me1">alpha</span> <span class="sy0">=</span> <span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; mBackView.<span class="me1">alpha</span> <span class="sy0">=</span> <span class="nu0">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>UIView commitAnimations<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.chewyapps.com/2009/09/14/fading-an-image-into-another/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing Broken Pipes</title>
		<link>http://www.chewyapps.com/2009/09/03/fixing-broken-pipes/</link>
		<comments>http://www.chewyapps.com/2009/09/03/fixing-broken-pipes/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 15:31:12 +0000</pubDate>
		<dc:creator>henning</dc:creator>
				<category><![CDATA[Development Tips]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[provisioning profile]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://www.chewyapps.com/?p=236</guid>
		<description><![CDATA[There&#8217;s nothing like the simulator for putting your app together quickly. It&#8217;s better than debugging on the device for one main reason: it&#8217;s fast! Starting up the app is fast. Debugging the app is fast. Everything is fast. But sometimes you just need to slow down. By using the device. Of course, I was testing [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.chewyapps.com/wp-content/uploads/2009/09/pipewrench.png" alt="pipewrench" title="pipewrench" width="150" height="150" align="right" />There&#8217;s nothing like the simulator for putting your app together quickly. It&#8217;s better than debugging on the device for one main reason: it&#8217;s fast! Starting up the app is fast. Debugging the app is fast. Everything is fast.</p>
<p>But sometimes you just need to <strong>slow down</strong>. By using the device. Of course, I was testing on the device today and made a critical error.</p>
<p>I couldn&#8217;t figure out what was wrong. I was getting error messages in the debugger console like this:</p>
<blockquote><p>putpkt: write failed: Broken pipe</p></blockquote>
<p>Or this:</p>
<blockquote><p>mem 0&#215;1000 0x3fffffff cache<br />
mem 0&#215;40000000 0xffffffff none<br />
mem 0&#215;00000000 0x0fff none</p></blockquote>
<p>Or even like this:</p>
<blockquote><p>Sent:  [1251990710.449:32] +<br />
Sent:  [1251990710.449:32] Hc-1<br />
Recvd: [1251990710.454:32] OK<br />
Sent:  [1251990710.455:32] qC<br />
Recvd: [1251990710.460:32] QC0<br />
Sent:  [1251990710.460:32] qStepPacketSupported<br />
Recvd: [1251990710.463:32] OK<br />
Sent:  [1251990710.478:49] QEnvironment:SHELL=/bin/bash<br />
Recvd: [1251990710.481:49] OK<br />
Sent:  [1251990710.481:49] QEnvironment:TMPDIR=/var/folders/UF/UFCJNauIGPu+F7L7bsqhZU+++TI/-Tmp-/<br />
Recvd: [1251990710.485:49] OK<br />
Sent:  [1251990710.485:49] QEnvironment:Apple_PubSub_Socket_Render=/tmp/launch-o19tpZ/Render<br />
Recvd: [1251990710.488:49] OK<br />
etc&#8230;..
</p></blockquote>
<p>It was quite frustrating.</p>
<p>So I looked around on the forums, and there were several questions about these errors, many of which went unanswered. (Forums can only get you so far sometimes.) But eventually I found the answer: <strong>you can&#8217;t debug your program if you&#8217;re using an ad hoc profile</strong>.</p>
<p>So I used the appropriate profile, and now I debug to my heart&#8217;s content. iPhone development seems to be straining with this kinds of gotchas. I just hope I remember this solution next time I find this problem. Writing it down will help, I hope! <img src='http://www.chewyapps.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.chewyapps.com/2009/09/03/fixing-broken-pipes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Images in a Scroll View</title>
		<link>http://www.chewyapps.com/2009/09/01/images-in-a-scroll-view/</link>
		<comments>http://www.chewyapps.com/2009/09/01/images-in-a-scroll-view/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 19:24:05 +0000</pubDate>
		<dc:creator>henning</dc:creator>
				<category><![CDATA[Development Tips]]></category>
		<category><![CDATA[UIImage]]></category>
		<category><![CDATA[UIScrollView]]></category>

		<guid isPermaLink="false">http://www.chewyapps.com/?p=229</guid>
		<description><![CDATA[I know that when I was a beginning iPhone developer doing things that seem so simple now weren&#8217;t so simple back then. Just because I didn&#8217;t know any better and was unaware of the tools and API&#8217;s available to me. One thing that I&#8217;ve been doing a lot recently is putting several images in a [...]]]></description>
			<content:encoded><![CDATA[<p>I know that when I was a beginning iPhone developer doing things that seem so simple now weren&#8217;t so simple back then. Just because I didn&#8217;t know any better and was unaware of the tools and API&#8217;s available to me.</p>
<p>One thing that I&#8217;ve been doing a lot recently is putting several images in a UIScrollView, so I thought I&#8217;d post the barebones version of the code here in case anyone finds it useful. Hopefully I&#8217;ll be able to add more snippets in the future.</p>
<div class="codesnip-container" >
<div class="c_mac codesnip" style="font-family:monospace;"><span class="co2">#define IMAGE_WIDTH &nbsp; 320</span><br />
<span class="co2">#define IMAGE_HEIGHT &nbsp;416</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; NSArray <span class="sy0">*</span>photos <span class="sy0">=</span> nil;&nbsp; &nbsp; &nbsp; <span class="co1">// TODO &#8211; fill with your photos</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="co1">// note that the view contains a UIScrollView in aScrollView</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> i<span class="sy0">=</span><span class="nu0">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span> NSString <span class="sy0">*</span>image in photos <span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UIImage <span class="sy0">*</span>image <span class="sy0">=</span> <span class="br0">&#91;</span>UIImage imageNamed<span class="sy0">:</span><span class="br0">&#91;</span>photos objectAtIndex<span class="sy0">:</span>i<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UIImageView <span class="sy0">*</span>imageView <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIImageView alloc<span class="br0">&#93;</span> initWithImage<span class="sy0">:</span>image<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imageView.<span class="me1">contentMode</span> <span class="sy0">=</span> UIViewContentModeScaleAspectFit;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imageView.<span class="me1">clipsToBounds</span> <span class="sy0">=</span> YES;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imageView.<span class="me1">frame</span> <span class="sy0">=</span> CGRectMake<span class="br0">&#40;</span> IMAGE_WIDTH <span class="sy0">*</span> i<span class="sy0">++</span>, 0, IMAGE_WIDTH, IMAGE_HEIGHT<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>aScrollView addSubview<span class="sy0">:</span>imageView<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>imageView release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; aScrollView.<span class="me1">contentSize</span> <span class="sy0">=</span> CGSizeMake<span class="br0">&#40;</span>IMAGE_WIDTH<span class="sy0">*</span>i, IMAGE_HEIGHT<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; aScrollView.<span class="me1">delegate</span> <span class="sy0">=</span> self;<br />
<span class="br0">&#125;</span></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.chewyapps.com/2009/09/01/images-in-a-scroll-view/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

