<?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>bunnyhero dev &#187; iPhone</title>
	<atom:link href="http://www.bunnyhero.org/category/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bunnyhero.org</link>
	<description>Notes on iPhone, Flash and Web development</description>
	<lastBuildDate>Mon, 07 Nov 2011 21:49:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Exploring Flixel</title>
		<link>http://www.bunnyhero.org/2011/03/07/exploring-flixel/</link>
		<comments>http://www.bunnyhero.org/2011/03/07/exploring-flixel/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 03:35:20 +0000</pubDate>
		<dc:creator>bunnyhero</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Video games]]></category>

		<guid isPermaLink="false">http://www.bunnyhero.org/?p=531</guid>
		<description><![CDATA[Flixel is a free, open source 2D game engine built in ActionScript 3, from Adam Atomic, creator of Canabalt and other games. I became especially curious about Flixel ever since the iOS version of Canabalt went open source at the end of 2010. Both the Flash and iOS versions of Canabalt use Flixel. I understand [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bunnyhero.org/wp-content/uploads/2011/03/flixel-header.png" alt="exploring flixel" title="exploring flixel" width="500" height="171" class="aligncenter size-full wp-image-546" style="margin: 0" /><br /><a href="http://flixel.org/">Flixel</a> is a free, open source 2D game engine built in ActionScript 3, from <a href="http://adamatomic.com">Adam Atomic</a>, creator of <a href="http://www.canabalt.com/">Canabalt</a> and other games. I became especially curious about Flixel ever since the iOS version of Canabalt <a href="http://blog.semisecretsoftware.com/nearly-25000-raised-for-charity-canabalt-goes">went open source at the end of 2010</a>. Both the Flash and iOS versions of Canabalt use Flixel. I understand that the iOS port of Flixel is still early, and from what I can tell, documentation for the iOS port is essentially nonexistent as of yet.</p>
<p>Regardless, here is my plan:</p>
<ol>
<li>Learn Flixel and create a game</li>
<li>Port it to iOS <em>[EDIT: that is, port <strong>my game</strong> to iOS, using the Flixel iOS port that is in the Canabalt source]</em></li>
<li>???</li>
<li>PROFIT!!!</li>
</ol>
<p>&#8230;all while blogging about the experience, of course. At least, that&#8217;s the idea &#8212; no promises that I&#8217;ll actually get very far! If I get really ambitious I might even write a tutorial at some point.</p>
<h3>First experiences</h3>
<p>Getting started with Flixel was pretty easy, thanks to the &#8220;Hello, World&#8221; tutorials available on the <a href="http://flashgamedojo.com/wiki/index.php?title=Category:Flixel">Flash Game Dojo wiki</a> (which appears to be the main documentation hub for Flixel). After that I wasn&#8217;t sure where to go next, since the documentation is a bit scattered and disorganized. I did find some great info on the <a href="https://github.com/AdamAtomic/flixel">Github project page</a> and <a href="https://github.com/AdamAtomic/flixel/wiki">wiki</a>, which oddly is not linked to from the Flixel home page (as I said, a bit scattered). Perhaps Flash Game Dojo is where all the action is supposed to be now? I&#8217;m not really sure.</p>
<p>What I&#8217;m finding most helpful right now are the very simple example games, complete with source code, provided by Adam Atomic, which are a great help to see how the framework expects things to be set up. The <a href="http://flixel.org/flxteroids/">FlxTeroids</a> source code is instructive, as well as <a href="http://flixel.org/EZPlatformer/">EZPlatformer</a> (which has a <a href="http://flashgamedojo.com/wiki/index.php?title=EZPlatformer_%28Flixel%29">nice tutorial</a> with it).</p>
<p>Despite the disorganization, there is a lot of good information out there, including the very active <a href="http://flixel.org/forums/">forums</a> (which I&#8217;ve not yet explored).</p>
<h3>A question of units</h3>
<p>One bit of info I couldn&#8217;t find was what units the FlxObject class uses for velocity and acceleration. I did a quick experiment, and it turns out that velocity is in <em>pixels per second</em>, and acceleration is in <em>pixels per second per second</em> &#8212; all very sensible, but it wasn&#8217;t explicitly stated anywhere I could find. Similarly, the angle and angularVelocity members are in <em>degrees</em> (not radians) and <em>degrees per second</em>.</p>
<h3>What&#8217;s next?</h3>
<p>This has been a bit of a rambling blog post (I, too, am a bit scattered!). Next I decide on what kind of game to make (something very simple) and start making it! Along the way I will share what I&#8217;ve learned.</p>
<p>Stay tuned&#8230;!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bunnyhero.org/2011/03/07/exploring-flixel/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>An iOS dev comic</title>
		<link>http://www.bunnyhero.org/2011/02/21/an-ios-dev-comic/</link>
		<comments>http://www.bunnyhero.org/2011/02/21/an-ios-dev-comic/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 01:56:35 +0000</pubDate>
		<dc:creator>bunnyhero</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.bunnyhero.org/?p=524</guid>
		<description><![CDATA[It&#8217;s a black art&#8230; if you can even get it to work.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bunnyhero.org/wp-content/uploads/2011/02/combined-vertical1.png" alt="" title="magic" width="400" height="918" class="aligncenter size-full wp-image-529" /><br />
It&#8217;s a black art&#8230; if you can even get it to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bunnyhero.org/2011/02/21/an-ios-dev-comic/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Descriptive text in iPhone settings bundles</title>
		<link>http://www.bunnyhero.org/2011/02/14/descriptive-text-in-iphone-settings-bundles/</link>
		<comments>http://www.bunnyhero.org/2011/02/14/descriptive-text-in-iphone-settings-bundles/#comments</comments>
		<pubDate>Mon, 14 Feb 2011 20:06:43 +0000</pubDate>
		<dc:creator>bunnyhero</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[settings]]></category>

		<guid isPermaLink="false">http://www.bunnyhero.org/?p=505</guid>
		<description><![CDATA[Back in the iPhone OS 3.x days, I would stare longingly at the Settings bundles in Apple&#8217;s built-in iPhone apps: If an app wanted explanatory text in the Settings app, you pretty much had to make do with Titles and Group titles. Ugly. It turns out that in iOS 4.0 and higher, Apple allowed for [...]]]></description>
			<content:encoded><![CDATA[<p>Back in the iPhone OS 3.x days, I would stare longingly at the Settings bundles in Apple&#8217;s built-in iPhone apps:<br />
<img src="http://www.bunnyhero.org/wp-content/uploads/2011/02/appleapps2.png" alt="" title="apple apps" width="448" height="311" class="aligncenter size-full wp-image-517" /></p>
<p>If an app wanted explanatory text in the Settings app, you pretty much had to make do with Titles and Group titles. Ugly.</p>
<p>It turns out that in iOS 4.0 and higher, Apple allowed for third-party apps to have descriptive text too. And I only found out about this last week (I noticed its use in the Ladidude app).</p>
<p>The longer descriptive text is called &#8220;<strong>Footer text</strong>&#8221; in Apple&#8217;s nomenclature, and can be attached to any Group. To add your own, do the following:</p>
<ol>
<li>Open your Settings.bundle Root.plist in Xcode</li>
<li>Go to the group you want footer text attached to.</li>
<li>Add a new Item to the Group and edit the key to be &#8220;FooterText&#8221; (you&#8217;ll have to type &#8220;FooterText&#8221; in manually):<br />
<img src="http://www.bunnyhero.org/wp-content/uploads/2011/02/footer-text-2.png" alt="" title="Adding footer text" width="491" height="253" class="aligncenter size-full wp-image-508" /></li>
<li>The set the value to whatever text you want to show up. If you need to insert linefeeds, type option-Enter.<br />
<img src="http://www.bunnyhero.org/wp-content/uploads/2011/02/footer-text-3.png" alt="" title="editing footer text" width="496" height="239" class="aligncenter size-full wp-image-509" /></li>
<li>Now you can visit your app&#8217;s settings in the Settings app. It should look something like this:<br />
<img src="http://www.bunnyhero.org/wp-content/uploads/2011/02/footer-text-4.png" alt="" title="Final footer text" width="320" height="299" class="aligncenter size-full wp-image-510" /></li>
</ol>
<p>If your app is compatible with iPhone OS 3.x as well, not to worry: the extra FooterText key is simply ignored on pre-iOS4 devices.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bunnyhero.org/2011/02/14/descriptive-text-in-iphone-settings-bundles/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simplifying wireless iPhone app distribution with PHP</title>
		<link>http://www.bunnyhero.org/2011/02/07/simplifying-wireless-iphone-app-distribution-with-php/</link>
		<comments>http://www.bunnyhero.org/2011/02/07/simplifying-wireless-iphone-app-distribution-with-php/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 19:31:52 +0000</pubDate>
		<dc:creator>bunnyhero</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[ios 4]]></category>
		<category><![CDATA[ota]]></category>

		<guid isPermaLink="false">http://www.bunnyhero.org/?p=484</guid>
		<description><![CDATA[iOS 4.0 came with the ability to distribute your ad hoc apps over the air, which is very convenient for testers. More details are available on Apple&#8217;s website. Unfortunately, doing this manually can be a bit of a hassle, partly because the everything in the XML manifest requires absolute URLs. I&#8217;ve created a PHP script [...]]]></description>
			<content:encoded><![CDATA[<p>iOS 4.0 came with the ability to distribute your ad hoc apps over the air, which is very convenient for testers. More details are available <a href="http://developer.apple.com/library/ios/featuredarticles/FA_Wireless_Enterprise_App_Distribution/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009979-CH1-SW11">on Apple&#8217;s website</a>. Unfortunately, doing this manually can be a bit of a hassle, partly because the everything in the XML manifest requires absolute URLs.</p>
<p>I&#8217;ve created a PHP script that makes this task somewhat easier.</p>
<p><strong>Requirements:</strong><br />
A web server that runs PHP 5 with the following extensions:</p>
<ul>
<li>ZIP</li>
<li>either MBString or Iconv</li>
<li>either BC or GMP or phpseclib</li>
</ul>
<p><strong>Installation/usage:</strong></p>
<ol>
<li><a href="http://www.bunnyhero.org/static/ota-php/ota-php.zip">Download</a> and unzip the files into a new directory on your web server.</li>
<li>Create a directory for each app you want to deploy (the directory cannot have any spaces in its name!).</li>
<li>In this directory, put:
<ul>
<li>the <code>.IPA</code> file of your app, built using Xcode&#8217;s &#8220;Build &#038; Archive&#8221; command (no spaces in the filename)</li>
<li>the <code>.mobileprovision</code> file (again, no spaces in the filename)</li>
<li>a 512&#215;512 PNG file named <code>iTunesArtwork.png</code> (case-sensitive)</li>
<li>a 72&#215;72 PNG file named <code>Icon.png</code> (case-sensitive)</li>
</ul>
<p>The directory structure should look like this:<br />
<img src="http://www.bunnyhero.org/wp-content/uploads/2011/02/ota-directory.png" alt="Directory layout for wireless app distribution PHP script" width="400" height="393" class="aligncenter size-full wp-image-487" />
</li>
<li>Now visit the web page that corresponds to the directory where you unzipped the files. You should see something like this:<br />
<img src="http://www.bunnyhero.org/wp-content/uploads/2011/02/ota-website.png" alt="" width="251" height="166" class="aligncenter size-full wp-image-489" /><br />
with one entry for each directory.</li>
<li>Visit the same page on an iOS device running iOS 4.0 or higher. You should be able to install the app simply by tapping on the corresponding &#8220;app&#8221; link. You shouldn&#8217;t need to install the provisioning profile separately, but if you do, it can also be installed via the web site by tapping on the &#8220;provisioning profile&#8221; link.</li>
</ol>
<p>That&#8217;s it. I admit the code is a bit of a mess, as it was hacked together relatively quickly. I haven&#8217;t been able to get it working when there are spaces in the names of the files or directories. Perhaps someone else can fix that :)</p>
<p>This code uses the <em>very</em> useful <a href="https://github.com/rodneyrehm/CFPropertyList">CFPropertyList PHP library</a> by Rodney Rehm to parse the Info.plist file that&#8217;s in the IPA, to extract all the info required by the XML manifest. That&#8217;s how the magic happens.</p>
<p><a href="http://www.bunnyhero.org/static/ota-php/ota-php.zip"><strong>Download the files here.</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bunnyhero.org/2011/02/07/simplifying-wireless-iphone-app-distribution-with-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Generating certificates for push notifications? Don&#8217;t use Chrome!</title>
		<link>http://www.bunnyhero.org/2010/11/03/generating-certificates-for-push-notifications-dont-use-chrome/</link>
		<comments>http://www.bunnyhero.org/2010/11/03/generating-certificates-for-push-notifications-dont-use-chrome/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 18:57:28 +0000</pubDate>
		<dc:creator>bunnyhero</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[apns]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[push]]></category>
		<category><![CDATA[stackoverflow]]></category>

		<guid isPermaLink="false">http://www.bunnyhero.org/?p=468</guid>
		<description><![CDATA[Thank you again Stack Overflow, for telling me why the Apple Push Notification service SSL Certificate Assistant (on the iOS Provisioning Portal) kept rejecting my certificate signing request. It turns out that for whatever reason, if you try uploading your certificate signing request using Chrome, it will fail with an error (Chrome bug? site bug?). [...]]]></description>
			<content:encoded><![CDATA[<p>Thank you again Stack Overflow, for telling me <a href="http://stackoverflow.com/questions/994761/iphone-developer-portal-wont-accept-my-csr/3775958#3775958">why the Apple Push Notification service SSL Certificate Assistant (on the iOS Provisioning Portal) kept rejecting my certificate signing request</a>.</p>
<p>It turns out that for whatever reason, if you try uploading your certificate signing request using Chrome, it will fail with an error (Chrome bug? site bug?). So: <strong>use Safari</strong> (or Firefox, apparently, based on the comments)!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bunnyhero.org/2010/11/03/generating-certificates-for-push-notifications-dont-use-chrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plague: 1; bunnyhero: 0</title>
		<link>http://www.bunnyhero.org/2010/10/25/plaue-1-bunnyhero-0/</link>
		<comments>http://www.bunnyhero.org/2010/10/25/plaue-1-bunnyhero-0/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 18:20:21 +0000</pubDate>
		<dc:creator>bunnyhero</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Video games]]></category>
		<category><![CDATA[october challenge]]></category>

		<guid isPermaLink="false">http://www.bunnyhero.org/?p=463</guid>
		<description><![CDATA[So after almost 3 weeks I&#8217;m finally feeling close to normal. Whiskey tango foxtrot! Plague from hell. That means there&#8217;s no way I could get anything approved for the app store before October ends. I suppose, in theory, I could get something ready to at least submit by then, but that means completing a whole [...]]]></description>
			<content:encoded><![CDATA[<p>So after almost 3 weeks I&#8217;m finally feeling close to normal. Whiskey tango foxtrot! Plague from hell.</p>
<p>That means there&#8217;s no way I could get anything approved for the app store before October ends. I suppose, in theory, I could get something ready to at least submit by then, but that means completing a whole game in a week&#8217;s time. It&#8217;s possible, but to be honest I&#8217;m not sure if I&#8217;m up to it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bunnyhero.org/2010/10/25/plaue-1-bunnyhero-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>October challenge week 1: ha! :(</title>
		<link>http://www.bunnyhero.org/2010/10/08/october-challenge-week-1-ha/</link>
		<comments>http://www.bunnyhero.org/2010/10/08/october-challenge-week-1-ha/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 19:19:10 +0000</pubDate>
		<dc:creator>bunnyhero</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Video games]]></category>
		<category><![CDATA[october challenge]]></category>

		<guid isPermaLink="false">http://www.bunnyhero.org/?p=453</guid>
		<description><![CDATA[I&#8217;m off to a terrible start, unfortunately :( This month started off very busy, with little time for me to work on the challenge, and now I&#8217;ve been struck down with some kind of plague that makes it very difficult to concentrate on anything for any length of time. All I&#8217;ve got so far are [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m off to a terrible start, unfortunately :( This month started off very busy, with little time for me to work on the <a href="http://www.bunnyhero.org/2010/10/01/october-challenge/">challenge</a>, and now I&#8217;ve been struck down with some kind of plague that makes it very difficult to concentrate on anything for any length of time.</p>
<p>All I&#8217;ve got so far are two rectangles on the screen. In theory, this will become a gameplay prototype. In practice&#8230; it&#8217;s two rectangles on the screen.</p>
<p>I sure hope I get better quick. Not going to give up just yet. In the meantime, I think I&#8217;ll just go and have a little lie down somewhere.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bunnyhero.org/2010/10/08/october-challenge-week-1-ha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>October Challenge</title>
		<link>http://www.bunnyhero.org/2010/10/01/october-challenge/</link>
		<comments>http://www.bunnyhero.org/2010/10/01/october-challenge/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 20:51:02 +0000</pubDate>
		<dc:creator>bunnyhero</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Video games]]></category>
		<category><![CDATA[october challenge]]></category>

		<guid isPermaLink="false">http://www.bunnyhero.org/?p=442</guid>
		<description><![CDATA[I have decided to try my hand at the October Challenge, AKA PoV&#8217;s Challenge. It&#8217;s a personal challenge to create and sell at least one copy of a game before the end of October. I&#8217;ve been meaning to participate in one of these game-making challenges for a while (like Ludum Dare, or Toronto Game Jam), [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bunnyhero.org/wp-content/uploads/2010/10/october-challenge.jpg" alt="" title="october challenge" width="470" height="199" class="aligncenter size-full wp-image-447" /><br />
I have decided to try my hand at <a href="http://www.ludumdare.com/compo/2010/09/22/povs-challenge-make-a-game-sell-1-copy/">the October Challenge, AKA PoV&#8217;s Challenge</a>. It&#8217;s a personal challenge to create and <em>sell</em> at least one copy of a game before the end of October.</p>
<p>I&#8217;ve been meaning to participate in one of these game-making challenges for a while (like <a href="http://www.ludumdare.com/">Ludum Dare</a>, or <a href="http://www.tojam.ca/">Toronto Game Jam</a>), but never have, partly because those 2- or 3-day sprints are a little too easy to procrastinate about (blink and they&#8217;re over! and I am a master procrastinator),  and partly because they seem a little too intensive for me in my advancing age (I like sleep!).</p>
<p>This one seems like something I could actually <em>do</em> and yet still be a kick-in-the-pants challenge. I like that PoV references <a href="http://www.nanowrimo.org/">NaNoWriMo</a> in his post :)</p>
<p>Since I plan to make an iOS game, fulfilling the last part of the challenge (sell a copy) is partly at the mercy of Apple&#8217;s app review process, but I&#8217;m going to give it my best shot anyway. And of course I plan to blog about it all here.</p>
<p>Wish me [good] luck! And let me know if you&#8217;ll be participating too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bunnyhero.org/2010/10/01/october-challenge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iOS4 multitasking: subtle UIViewController change</title>
		<link>http://www.bunnyhero.org/2010/08/31/ios4-multitasking-subtle-uiviewcontroller-change/</link>
		<comments>http://www.bunnyhero.org/2010/08/31/ios4-multitasking-subtle-uiviewcontroller-change/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 20:51:25 +0000</pubDate>
		<dc:creator>bunnyhero</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[ios4]]></category>
		<category><![CDATA[multitasking]]></category>

		<guid isPermaLink="false">http://www.bunnyhero.org/?p=420</guid>
		<description><![CDATA[UIApplicationDelegate changed a lot with the introduction of multitasking in iOS4 (see Dr. Touch&#8217;s post and charts [although there are still some small omissions and inaccuracies there]). But UIApplicationDelegate was not the only class affected. UIViewController&#8216;s behaviour is slightly changed in the presence of multitasking: namely the view(Will&#124;Did)Disappear: methods. If your iOS4-built app is running [...]]]></description>
			<content:encoded><![CDATA[<p><code>UIApplicationDelegate</code> changed a lot with the introduction of multitasking in iOS4 (see <a href="http://www.drobnik.com/touch/2010/07/understanding-ios-4-backgrounding-and-delegate-messaging/">Dr. Touch&#8217;s post and charts</a> [although there are still some small omissions and inaccuracies there]).</p>
<p>But <code>UIApplicationDelegate</code> was not the only class affected. <code>UIViewController</code>&#8216;s behaviour is slightly changed in the presence of multitasking: namely the <code>view(Will|Did)Disappear:</code> methods.</p>
<p>If your iOS4-built app is running on iPhone OS 3, <em>or</em> if <code>UIApplicationExitsOnSuspend</code> is set to <code>true</code>, then when the user presses the Home button, the frontmost view controller&#8217;s <code>viewWillDisappear:</code> and <code>viewDidDisappear:</code> methods will be called before the app exits. However, if <code>UIApplicationExitsOnSuspend</code> is <code>false</code> and you&#8217;re running on a multitasking-enabled device (iPhone 3GS or higher; iPod touch 3rd generation),  <code>viewWillDisappear:</code> and <code>viewDidDisappear:</code> <strong><em>are not called</em> as it enters the background</strong>.</p>
<p>That was a messy couple of sentences so here&#8217;s a chart!</p>
<style>table.mtaskvc { border-collapse:collapse;border:1px solid black; }
table.mtaskvc, .mtaskvc td,  .mtaskvc th { border:1px solid black;text-align:center }
.mtaskvc th { background:#666;color:white }
</style>
<table class="mtaskvc">
<tr>
<th>UIApplication&shy;Exits&shy;On&shy;Suspend?</th>
<th>multitasking-capable device and OS?</th>
<th>When Home button is pressed:</th>
</tr>
<tr>
<td>false</td>
<td>true</td>
<td><code>viewWill/DidDisappear:</code> NOT called</td>
</tr>
<tr>
<td>false</td>
<td>false</td>
<td><code>viewWill/DidDisappear:</code> IS called</td>
</tr>
<tr>
<td>true</td>
<td>true</td>
<td><code>viewWill/DidDisappear:</code> IS called</td>
</tr>
<tr>
<td>true</td>
<td>false</td>
<td><code>viewWill/DidDisappear:</code> IS called</td>
</tr>
</table>
<p>It&#8217;s subtle, but it might make a difference to your code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bunnyhero.org/2010/08/31/ios4-multitasking-subtle-uiviewcontroller-change/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Sparrow Framework</title>
		<link>http://www.bunnyhero.org/2010/08/22/the-sparrow-framework/</link>
		<comments>http://www.bunnyhero.org/2010/08/22/the-sparrow-framework/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 21:53:10 +0000</pubDate>
		<dc:creator>bunnyhero</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[idevblogaday]]></category>
		<category><![CDATA[sparrow]]></category>

		<guid isPermaLink="false">http://www.bunnyhero.org/?p=408</guid>
		<description><![CDATA[When I first started iPhone programming last year, I decided I wanted to stay away from third-party frameworks at first, so I could learn as much of the native environment as possible. My first animation-based project used CALayers, but I later converted it to use OpenGL for better performance. I am definitely not opposed to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bunnyhero.org/wp-content/uploads/2010/08/sparrow-logo.jpg" alt="" title="sparrow-logo" width="300" height="80" class="aligncenter size-full wp-image-416" /><br />
When I first started iPhone programming last year, I decided I wanted to stay away from third-party frameworks at first, so I could learn as much of the native environment as possible. My first animation-based project used CALayers, but I later converted it to use OpenGL for better performance.</p>
<p>I am definitely not opposed to using third-party frameworks. When I&#8217;m not trying to wring the last bit of performance out of a device, I&#8217;d rather deal with higher-level abstractions than directly with OpenGL.</p>
<p><a href="http://www.cocos2d-iphone.org/">Cocos2D-iPhone</a> is a very popular open source framework for 2D games and graphics applications. It seems very feature-rich, including things like visual effects, particle systems and even integrated physics engines!</p>
<p>But I was immediately drawn to the <a href="http://www.sparrow-framework.org/">Sparrow Framework</a> when I first heard about it. It, too, is an open source 2D graphics/game framework for iOS. It has far fewer features than Cocos2D (possibly a boon, depending on your outlook—less code to add to your app) but its main attraction (to me) is that it is modelled after the ActionScript 3 API. For someone like myself who has used Flash for many years, this is a definite plus.</p>
<p>When I was writing the <a href="http://www.bunnyhero.org/2010/08/15/turn-your-iphone-into-a-vampire-with-avfoundation-and-ios-4/">Vampire simulator</a>, I needed to make the vampire sparkle. I figured that this simple animation task would be well suited for my first exploration of the Sparrow framework.</p>
<p>Creating a new Sparrow app is very simple. Just duplicate the &#8220;scaffold&#8221; folder and rename the Xcode project within. You will have to do a one-time Xcode settings change: adding a SPARROW_SRC folder reference to point to where the Sparrow source files are on your hard drive.</p>
<p>The <a href="http://www.sparrow-framework.org/help/">documentation</a> that is available for Sparrow is minimal but very, very clearly written. Also, the source code is easy to follow. If you have any background with the ActionScript 3 class library, the learning curve is practically zero. I was shocked at how quickly I was making things happen with it.</p>
<p>Here&#8217;s a simple example from the vampire app. This snippet places the image &#8220;vampire.png&#8221; at the centre of the screen:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">SPImage <span style="color: #002200;">*</span>image <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>SPImage imageWithContentsOfFile<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;vampire.png&quot;</span><span style="color: #002200;">&#93;</span>;
image.x <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>self.width <span style="color: #002200;">-</span> image.width<span style="color: #002200;">&#41;</span> <span style="color: #002200;">/</span> <span style="color: #2400d9;">2</span>;
image.y <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>self.height <span style="color: #002200;">-</span> image.height<span style="color: #002200;">&#41;</span> <span style="color: #002200;">/</span> <span style="color: #2400d9;">2</span>;
<span style="color: #002200;">&#91;</span>self addChild<span style="color: #002200;">:</span>image<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Responding to events (touch events, or timing) will be familiar to you if you&#8217;ve used ActionScript (or JavaScript, for that matter), using the <code>addEventListener</code> method:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"> <span style="color: #002200;">&#91;</span>self addEventListener<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>onEnterFrame<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span> atObject<span style="color: #002200;">:</span>self forType<span style="color: #002200;">:</span>SP_EVENT_TYPE_ENTER_FRAME<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>This will cause the <code>onEnterFrame:</code> method on <code>self</code> to be called on every frame of the animation.</p>
<p>Refugees from Flash should note: while Sparrow is modelled after the ActionScript 3 libraries, it is only a small, small subset of it. For example, it does <em>not</em> include any of drawing API (on the other hand, if you want to do any custom drawing, you can subclass <code>SPDisplayObject</code> and draw with OpenGL directly).</p>
<p>I definitely plan to use Sparrow for whatever my next game project might be. I&#8217;ll likely have more to say about it then. I&#8217;ll be interested to see how performance holds up if a lot of elements are flying around the screen.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bunnyhero.org/2010/08/22/the-sparrow-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

