<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>iCodeBlog</title>
	
	<link>http://icodeblog.com</link>
	<description>iPhone Programming Tutorials</description>
	<pubDate>Thu, 09 Jul 2009 19:09:21 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/icodeblog" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>iPhone Programming Tutorial: Integrating Twitter Into Your iPhone Applications</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/7ijlHiqbleQ/</link>
		<comments>http://icodeblog.com/2009/07/09/integrating-twitter-into-your-applications/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 18:23:03 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[iPhone Programming Tutorials]]></category>

		<category><![CDATA[iphone twitter]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[twitter iphone tutorial]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=1080</guid>
		<description><![CDATA[
If you are a developer (which you most likely are if you are reading this) you probably have (or should have) a Twitter account.  With Twitter getting so much attention lately, you would be crazy to not include some sort of Twitter integration into your own iPhone application.
There are many ways applications can be made [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_12.png"><img class="aligncenter size-full wp-image-1090" title="screenshot_12" src="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_12.png" alt="screenshot_12" width="600" /></a></p>
<p>If you are a developer (which you most likely are if you are reading this) you probably have (or should have) a Twitter account.  With Twitter getting so much attention lately, you would be crazy to not include some sort of Twitter integration into your own iPhone application.</p>
<p>There are many ways applications can be made more social by including Twitter.  For example, you could make the application auto-tweet when you unlock a special item in a game, or beat it.  This lets all of their friends know they are playing your game and in turn gets you more exposure.  You could also use this as an idea for creating your own Twitter client (<a href="http://icodeblog.com/2009/07/08/look-familiar/">don&#8217;t just submit my tutorial to the app store</a>).</p>
<p>Twitter has provided us with some very simple API&#8217;s to follow making it a snap to interface with them. I have started a series on my personal blog about <a href="http://brandontreb.com/objective-c-programming-tutorial-creating-a-twitter-client-part-1/" onclick="pageTracker._trackPageview('/outgoing/brandontreb.com/objective-c-programming-tutorial-creating-a-twitter-client-part-1/?referer=');">creating a Twitter client for the Mac</a> that we will be borrowing some code from.</p>
<p>One thing I want to note before starting is: I will be going rather quick through the tutorial when it comes to creating the interface and hooking up the IBOutlets.  If you need extended help on that, this is probably not the tutorial you want to start on. Read some of my previous tutorials and come back.</p>
<p>This basic tutorial will just show you how to post a status update to your Twitter. I will also show you how to create an app that run entirely in landscape mode. So it&#8217;s a two-fer.</p>
<p>Let&#8217;s get started&#8230;</p>
<h2>1. Create A View Based Application</h2>
<p style="text-align: center;"><a href="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_02.png"><img class="size-full wp-image-1084 aligncenter" title="screenshot_02" src="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_02.png" alt="screenshot_02" width="600" height="442" /></a></p>
<p style="text-align: left;">
<p style="text-align: left;">Name it something <strong>awesome</strong>. I called mine TwitUpdate (not awesome, I know).  The first thing we should do is create our IBOutets and IBActions. Now download the images for the tutorial and drag them into the <strong>Resources</strong> group inside of XCode.</p>
<ul>
<li><a href="http://icodeblog.com/wp-content/uploads/2009/07/btn_update.png"><img class="size-full wp-image-1093 alignnone" title="btn_update" src="http://icodeblog.com/wp-content/uploads/2009/07/btn_update.png" alt="btn_update" width="97" height="36" /></a></li>
<li><a href="http://icodeblog.com/wp-content/uploads/2009/07/twit_background.png"><img class="size-full wp-image-1094 alignnone" title="twit_background" src="http://icodeblog.com/wp-content/uploads/2009/07/twit_background.png" alt="twit_background" width="480" height="320" /></a></li>
</ul>
<p style="text-align: center;"><a href="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_04.png"><img class="size-full wp-image-1085 aligncenter" title="screenshot_04" src="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_04.png" alt="screenshot_04" width="188" height="341" /></a></p>
<h2 style="text-align: left;">2. Set up your IBoutlets and IBActions</h2>
<p style="text-align: left;">So open <strong>TwitUpdateViewController.h. </strong>And let&#8217;s add the following code:</p>
<p style="text-align: center;"><a href="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_18.png"><img class="size-full wp-image-1098 aligncenter" title="screenshot_18" src="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_18.png" alt="screenshot_18" width="445" height="223" /></a></p>
<p style="text-align: left;">You can omit the UIButton outlets if you would like.  I just like having them around in case we want to do anything with the button.  This is pretty straight forward, we have a UITextView to enter our Twitter status in. And an IBAction that gets called to post our Twitter status.  Don&#8217;t forget to synthesize these properties in <strong>TwitUpdateViewController.m</strong> or you will be smitten by the compiler.  One other thing you will see here is a UIActionSheet.  We will display this sheet as our &#8220;Loading&#8221; screen when posting a tweet.</p>
<h2 style="text-align: left;">3. Build The Interface</h2>
<p style="text-align: left;">Go ahead and open up <strong>TwitUpdateViewController.xib.</strong></p>
<p style="text-align: left;">So if you are wondering how to get Interface Builder in landscape mode, it&#8217;s actually quite simple.  It is not obvious however as it took me forever and a freakin day to figure it out.  There is a little arrow (as in the screenshot below) in the top right corner of the view.  Click it and the view will rotate to landscape mode.</p>
<p style="text-align: left;"><a href="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_15.png"><img class="aligncenter size-full wp-image-1092" title="screenshot_15" src="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_15.png" alt="screenshot_15" width="69" height="55" /></a></p>
<p style="text-align: left;">Now that your interface is in landscape mode, remove the <strong>Status Bar</strong>.  This is done by clicking on the view and setting the <strong>Status Bar</strong> drop down in the <strong>attributes inspector</strong> to <strong>none. </strong>This will just give you more screen real estate.</p>
<p style="text-align: left;">Now drag a UIImageView on your view and stretch it to fill the entire screen.  Set the <strong>Image</strong> attribute of the UIImageView to be <strong>twit_background.png </strong>and bask in the glory of my beautifully created interface!  Next, we need to add the UITextView.</p>
<p style="text-align: left;">Grab a UITextView and drag in on to the view and stretch it to fit just inside of the chat bubble.  Make sure to delete the lorem ipsum text inside.</p>
<p style="text-align: left;">The last interface element we need to add is the update button.  Drag a UIButton on to your view.  In the button&#8217;s attributes, set it&#8217;s type to custom and it&#8217;s image to <strong>btn_update.png.</strong> Make sure you drag the button to fit the update image. Your final interface should look like this</p>
<p style="text-align: left;"><a href="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_11.png"><img class="aligncenter size-full wp-image-1089" title="screenshot_11" src="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_11.png" alt="screenshot_11" width="480" height="322" /></a></p>
<p style="text-align: left;">Now, connect the <strong>twitterMessageText </strong>from File&#8217;s Owner to the UITextView and the <strong>updateButton </strong>to your custom button.  Also, be sure to connect the <strong>TouchUpInside</strong> method of the UIButton to the <strong>postTweet</strong> IBAction.  Here is a screenshot of what the connection properties should look like when you click on File&#8217;s owner.</p>
<p style="text-align: left;"><a href="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_08.png"><img class="aligncenter size-full wp-image-1087" title="screenshot_08" src="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_08.png" alt="screenshot_08" width="775" height="225" /></a></p>
<p style="text-align: left;">Now close Interface Builder.</p>
<h2 style="text-align: left;">4. Creating Our Twitter Request Class</h2>
<p style="text-align: left;">So, we will interface with Twitter using an NSMutableURL request and NSURLConnection.  You have two options at this juncture, you can either download the files below and add them to your project to use, or you can head on over to <a href="http://brandontreb.com/objective-c-programming-tutorial-creating-a-twitter-client-part-1/" onclick="pageTracker._trackPageview('/outgoing/brandontreb.com/objective-c-programming-tutorial-creating-a-twitter-client-part-1/?referer=');">http://brandontreb.com/objective-c-programming-tutorial-creating-a-twitter-client-part-1/</a> and learn how to create them yourself (recommended route).  I would explain it here, it&#8217;s just that I already wrote an in depth tutorial for it on my blog. This is now a tutorial scavenger hunt.</p>
<ul>
<li><a href="http://icodeblog.com/wp-content/uploads/2009/07/twitterrequest.zip">twitterrequest.zip</a></li>
</ul>
<p>If you just want to complete this tutorial and move on, download the file above, unzip and drag the files into your project.  We need to add some code to these files in order to post a status update to Twitter.  So, open TwitterRequest.h and update the following code</p>
<p style="text-align: center;"><a href="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_16.png"><img class="size-full wp-image-1096 aligncenter" title="screenshot_16" src="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_16.png" alt="screenshot_16" width="672" height="414" /></a></p>
<p style="text-align: left;">We have added a Boolean that denotes whether or not we are making a HTTP POST request (Twitter uses both POST and GET).  Also, there is a string that will represent the POST request.  In our case, this will just get set to &#8220;status=foo&#8221; (foo being your status update).</p>
<p style="text-align: left;">Also, we have added a method signature to update your status.  It takes an NSString which is just the status text.  The other variables are explained in my tutorial on brandontreb.com.  Now, open up <strong>TwitterRequest.m</strong> and add the following code.</p>
<p style="text-align: center;"><a href="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_17.png"><img class="size-full wp-image-1097 aligncenter" title="screenshot_17" src="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_17.png" alt="screenshot_17" width="756" height="331" /></a></p>
<p style="text-align: left;">Ok, beginning with the status_update method.  This method looks very similar to our friends_timeline method with a few exceptions.  First, we set isPost = YES.  Next, we set the request body = &#8220;status=%@&#8221; where we set %@ to our status update.</p>
<p style="text-align: left;">Now, for some trickier code.  In the request method of our class, we need to add some code to do an HTTP POST (rather than a GET).  This is how we tell Twitter what to set our status to.  So, the first thing is to set the HTTPMethod for the request to POST.  Next, we have set the &#8220;Content-Type&#8221; field to let Twitter know what kind of data we are sending.  Following that, the body of the request is sent.  This is the actual data that Twitter will see.  Finally, we just tell the request how large (in bytes) our data is going to be.  If this is all foreign to you, I recommend you go read up on POST and GET.</p>
<p style="text-align: left;">Phew&#8230; Done with that.  Now for the final part of implementing our postTweet method.</p>
<h2 style="text-align: left;">5. PostTweet Method</h2>
<p style="text-align: left;">Open up TwitterUpdateViewController.m and add the following code.</p>
<p style="text-align: center;"><a href="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_20.png"><img class="size-full wp-image-1099 aligncenter" title="screenshot_20" src="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_20.png" alt="screenshot_20" width="705" height="339" /></a></p>
<p style="text-align: left;">Ok, not super complex as the TwitterRequest class does most of the heavy lifting.  As a reminder, the postTweet method gets called when you press the Update button.  The first thing we do here is build a new TwitterRequest object and set the username and password field.  Make sure you put in YOUR twitter username and password.  Next, we call the resignFirstResponder method on the UITextView.  This is to hide the keyboard.</p>
<p style="text-align: left;">Just so the user knows something is happening, we display a simple action sheet that has no buttons and says &#8220;Posting to Twitter&#8230;&#8221; . Finally, we call the statuses_update method in our TwitterRequest class.</p>
<p style="text-align: left;">The Twitter request class will then do some magic and eventually call the callback method that you specified (status_updateCallback) and send it the data that Twitter returned to us.  The first thing we do is dismiss the action sheet. Next, I am simply outputting the response from Twitter in to the terminal.</p>
<p style="text-align: left;">The response received from Twitter would need to be parsed and displayed or something but that&#8217;s for another tutorial.One thing to note, if you enter an invalid username or password, this app will just hang and say  &#8220;Posting to Twitter&#8221; forever.  You need to handle this in an error callback method. Again <a href="http://brandontreb.com/objective-c-programming-tutorial-creating-a-twitter-client-part-1/" onclick="pageTracker._trackPageview('/outgoing/brandontreb.com/objective-c-programming-tutorial-creating-a-twitter-client-part-1/?referer=');">described in the tutorial</a> in which we took the TwitterRequest code from.</p>
<h2 style="text-align: left;">6. Run The App In Landscape Mode</h2>
<p style="text-align: left;">The last part of this tutorial is to force the app to run in landscape mode as well as hide the status bar.  Open up TwitUpdate-Info.plist. Right click on the table and select &#8220;Add Row&#8221;. Select <strong>Initial interface orientation</strong> and set the value to Landscape (left or right).  Right click again and add <strong>Status bar is initially hidden</strong>. to hide the status bar.  It should now look like this.</p>
<p style="text-align: left;"><a href="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_21.png"><img class="size-full wp-image-1105 aligncenter" title="screenshot_21" src="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_21.png" alt="screenshot_21" width="418" height="56" /></a>We also need to update the TwitUpdateViewConroller.m file to respond to the interface rotations.  Uncomment the following method in <strong>TwitUpdateViewController.m</strong> and change it to say:</p>
<p style="text-align: center;"><a href="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_22.png"><img class="size-full wp-image-1106 aligncenter" title="screenshot_22" src="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_22.png" alt="screenshot_22" width="571" height="91" /></a></p>
<p style="text-align: left;">Just tells the the view to rotate when the iphone is rotated&#8230;</p>
<p style="text-align: left;">Well, I hope you have enjoyed this tutorial.  I hope to see some cool Twitter integration in all of your apps (feel free to comment and let me know how you have implemented it in your app).  You can always ask questions in the comments of the post or <a href="http://twitter.com/brandontreb" onclick="pageTracker._trackPageview('/outgoing/twitter.com/brandontreb?referer=');">write me on twitter</a>.  And for lazy people <a href="http://icodeblog.com/wp-content/uploads/2009/07/twitupdate.zip">here is the source</a> (j/k).  Happy iCoding.</p>
<p style="text-align: left;">
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/7ijlHiqbleQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/07/09/integrating-twitter-into-your-applications/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/07/09/integrating-twitter-into-your-applications/</feedburner:origLink></item>
		<item>
		<title>Look Familiar?</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/QCzXaFgfCJM/</link>
		<comments>http://icodeblog.com/2009/07/08/look-familiar/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 17:53:53 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[iphone]]></category>

		<category><![CDATA[iphone game]]></category>

		<category><![CDATA[moron]]></category>

		<category><![CDATA[thief]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=1076</guid>
		<description><![CDATA[Ok, so I was perusing the App Store the other day to stumble upon this gem of an application. See the screenshot below.

If you have been on iCodeBlog before, you might recognize this &#8220;game&#8221; from a tutorial that I wrote about writing an iPhone game (link).  One thing to note here is the company name [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so I was perusing the App Store the other day to stumble upon this gem of an application. See the screenshot below.</p>
<p><a href="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_01.png"><img class="aligncenter size-full wp-image-1077" title="screenshot_01" src="http://icodeblog.com/wp-content/uploads/2009/07/screenshot_01.png" alt="screenshot_01" width="600" /></a></p>
<p>If you have been on iCodeBlog before, you might recognize this &#8220;game&#8221; from a tutorial that I wrote about writing an iPhone game (<a href="http://icodeblog.com/2009/01/15/iphone-game-programming-tutorial-part-1/">link</a><a></a>).  One thing to note here is the company name is BlaBlaIncTech (not iCodeBlog) meaning I did not submit this nor did I give permission to do so.  I find it interesting that someone has the guts to take a tutorial on iCodeBlog and submit it to the app store <strong>unmodified</strong>.</p>
<p>Not only was this VERY basic code meant to teach simple concepts, the graphics are absolutely atrocious as they were hacked together very quickly in Photoshop.  I actually find this quite hilarious that this guys expects me not to find out.</p>
<p>I wanted to highlight some of the great features noted by the &#8220;developer&#8221; of this application (Seen in the feature section of iTunes).</p>
<ul>
<li>&#8220;It&#8217;s basic game design makes it a fun game for someone that doesn&#8217;t play alot of games&#8221; - WOW, emphasis on the BASIC.  This game is fun for no one as it sucks! It was meant as a teaching tool moron!</li>
<li>&#8220;Great Quality&#8221; - Are we looking at the same game?</li>
<li>&#8220;Easy (So easy your grandma can play)&#8221; - If you have the same taste in games as your grandma, you probably don&#8217;t own an iPhone.</li>
<li>&#8220;<strong>Almost no crashes</strong>&#8221; - hahahaha this is the best one. The keyword here is &#8220;Almost&#8221;.  Well, that does it, I&#8217;m sold!</li>
</ul>
<p>So, if you want to scoop up this rad game, the link is <a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=317420248&amp;mt=8" onclick="pageTracker._trackPageview('/outgoing/itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=317420248_amp_mt=8&amp;referer=');">here</a> . I almost will pay him the $.99, just to make fun of him in the comments section.</p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/QCzXaFgfCJM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/07/08/look-familiar/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/07/08/look-familiar/</feedburner:origLink></item>
		<item>
		<title>Objective C 2.0: An Intro - Part 2</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/e8qFYgs0KrQ/</link>
		<comments>http://icodeblog.com/2009/06/29/objective-c-20-an-intro-part-2/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 01:47:15 +0000</pubDate>
		<dc:creator>Collin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=1008</guid>
		<description><![CDATA[Introduction
Hello everyone, welcome to my fourth screeencast. This is the second in my series introducing readers to Objective C. Let&#8217;s dive in.
Skill Level Beginner
Source Code

Available Here
Screencast
I film myself coding out the entire sample project for each post. I personally think going through the Screencast is the best way to learn. But feel free to look [...]]]></description>
			<content:encoded><![CDATA[<h3><span style="color: #ff6600;">Introduction</span></h3>
<p>Hello everyone, welcome to my fourth screeencast. This is the second in my series introducing readers to Objective C. Let&#8217;s dive in.</p>
<h2><span style="color: #000000;">Skill Level</span> <span style="color: #008000;">Beginner</span></h2>
<h1><span style="color: #ff6600;">Source Code<br />
</span></h1>
<h3><a title="Using NSXMLParser to Pull UIImages from the Web" href="http://losectrl-gaincommand.com/iCodeBlogHelper/Tutorial4/iCodeBlogGetsClassy.zip" onclick="pageTracker._trackPageview('/outgoing/losectrl-gaincommand.com/iCodeBlogHelper/Tutorial4/iCodeBlogGetsClassy.zip?referer=');"><span style="text-decoration: underline;">Available Here</span></a></h3>
<h1><span style="color: #ff6600;">Screencast</span></h1>
<p>I film myself coding out the entire sample project for each post. I personally think going through the Screencast is the best way to learn. But feel free to look through the slides and text if that suites you better.</p>
<p><a href="http://vimeo.com/5513767" onclick="pageTracker._trackPageview('/outgoing/vimeo.com/5513767?referer=');">iCodeBlog Tutorial: Objective C 2.0 An Intro Part 2</a> from <a href="http://vimeo.com/user2008025" onclick="pageTracker._trackPageview('/outgoing/vimeo.com/user2008025?referer=');">Collin Ruffenach</a> on <a href="http://vimeo.com" onclick="pageTracker._trackPageview('/outgoing/vimeo.com?referer=');">Vimeo</a>.</p>
<h1><span style="color: #ff6600;">Tutorial</span></h1>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2001.png" alt="objectivec20anintropt2001" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2002.png" alt="objectivec20anintropt2002" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2003.png" alt="objectivec20anintropt2003" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2004.png" alt="objectivec20anintropt2004" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2005.png" alt="objectivec20anintropt2005" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2006.png" alt="objectivec20anintropt2006" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2007.png" alt="objectivec20anintropt2007" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2008.png" alt="objectivec20anintropt2008" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2009.png" alt="objectivec20anintropt2009" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2010.png" alt="objectivec20anintropt2010" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2011.png" alt="objectivec20anintropt2011" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2012.png" alt="objectivec20anintropt2012" width="620" height="465" /></p>
<h2><span style="color: #ff6600;">iCodeBlogClass.m:</span></h2>
<pre style="padding-left: 60px;">@implementation iCodeBlogClass

@synthesize name;

-init
{
	return self;
}

@end</pre>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2013.png" alt="objectivec20anintropt2013" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2014.png" alt="objectivec20anintropt2014" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2015.png" alt="objectivec20anintropt2015" width="620" height="465" /></p>
<h2><span style="color: #ff6600;">iCodeBlogGetsClassy.h:</span></h2>
<pre style="padding-left: 60px;">#import "iCodeBlogClass.h"</pre>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2016.png" alt="objectivec20anintropt2016" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2013.png" alt="objectivec20anintropt2013" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2014.png" alt="objectivec20anintropt2014" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2015.png" alt="objectivec20anintropt2015" width="620" height="465" /></p>
<h2><span style="color: #ff6600;">iCodeBlogGetsClassy.h:</span></h2>
<pre style="padding-left: 60px;">iCodeBlogClass *myNewObject = [[iCodeBlogClass alloc] init];
NSLog(@"%@", myNewObject);</pre>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2017.png" alt="objectivec20anintropt2017" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2018.png" alt="objectivec20anintropt2018" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2019.png" alt="objectivec20anintropt2019" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2020.png" alt="objectivec20anintropt2020" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2021.png" alt="objectivec20anintropt2021" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2022.png" alt="objectivec20anintropt2020" width="622" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2023.png" alt="objectivec20anintropt2023" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2024.png" alt="objectivec20anintropt2024" width="620" height="465" /></p>
<h2><span style="color: #ff6600;">iCodeBlogClass.h:</span></h2>
<pre style="padding-left: 60px;">#import &lt;Foundation/Foundation.h&gt;

@interface iCodeBlogClass : NSObject
{
	NSString *name;
}

@property (nonatomic, retain) NSString *name;

@end</pre>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2025.png" alt="objectivec20anintropt2025" width="620" height="465" /></p>
<h2><span style="color: #ff6600;">iCodeBlogClass.m:</span></h2>
<pre style="padding-left: 60px;">@synthesize name;</pre>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2026.png" alt="objectivec20anintropt2026" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2027.png" alt="objectivec20anintropt2027" width="620" height="465" /></p>
<h2><span style="color: #ff6600;">iCodeBlogGetsClassy.m:</span></h2>
<pre style="padding-left: 60px;">iCodeBlogClass *myNewObject = [[iCodeBlogClass alloc] init];
[myNewObject setName:@"Collin"];

NSLog(@"%@", [myNewObject name]);</pre>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2028.png" alt="objectivec20anintropt2028" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2029.png" alt="objectivec20anintropt2029" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2030.png" alt="objectivec20anintropt2030" width="620" height="465" /></p>
<h2><span style="color: #ff6600;">iCodeBlogClass.m:</span></h2>
<pre style="padding-left: 60px;">-initWithName:(NSString *)inputName
{
     self.name = inputName;
     return self;
}</pre>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2031.png" alt="objectivec20anintropt2031" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2032.png" alt="objectivec20anintropt2032" width="620" height="465" /></p>
<h2><span style="color: #ff6600;">iCodeBlogGetsClassy.m:</span></h2>
<pre style="padding-left: 60px;">iCodeBlogClass *myNewObject = [[iCodeBlogClass alloc] initWithName:@"Collin"];</pre>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2033.png" alt="objectivec20anintropt2033" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2034.png" alt="objectivec20anintropt2034" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2035.png" alt="objectivec20anintropt2035" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2036.png" alt="objectivec20anintropt2036" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2037.png" alt="objectivec20anintropt2037" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2038.png" alt="objectivec20anintropt2038" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2039.png" alt="objectivec20anintropt2039" width="620" height="465" /></p>
<h2><span style="color: #ff6600;">iCodeBlogGetsClassy.m:</span></h2>
<pre style="padding-left: 60px;">iCodeBlogClass *person1 = [[iCodeBlogClass alloc] initWithName:@"Collin"];</pre>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2040.png" alt="objectivec20anintropt2040" width="620" height="465" /></p>
<h2><span style="color: #ff6600;">iCodeBlogGetsClassy.m:</span></h2>
<pre style="padding-left: 60px;">	iCodeBlogClass *person1 = [[iCodeBlogClass alloc] initWithName:@"Collin"];
	iCodeBlogClass *person2 = [[iCodeBlogClass alloc] initWithName:@"Martin"];
	iCodeBlogClass *person3 = [[iCodeBlogClass alloc] initWithName:@"vtsib"];
	iCodeBlogClass *person4 = [[iCodeBlogClass alloc] initWithName:@"AppStoreMod"];
	iCodeBlogClass *person5 = [[iCodeBlogClass alloc] initWithName:@"Matt"];
	iCodeBlogClass *person6 = [[iCodeBlogClass alloc] initWithName:@"Brendan"];
	iCodeBlogClass *person7 = [[iCodeBlogClass alloc] initWithName:@"Geoff"];
	iCodeBlogClass *person8 = [[iCodeBlogClass alloc] initWithName:@"RobotGrrl"];
	iCodeBlogClass *person9 = [[iCodeBlogClass alloc] initWithName:@"brandon"];
	iCodeBlogClass *person10 = [[iCodeBlogClass alloc] initWithName:@"Aaron"];
	iCodeBlogClass *person11 = [[iCodeBlogClass alloc] initWithName:@"Brian"];
	iCodeBlogClass *person12 = [[iCodeBlogClass alloc] initWithName:@"Fernando"];
	iCodeBlogClass *person13 = [[iCodeBlogClass alloc] initWithName:@"Chad"];</pre>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2041.png" alt="objectivec20anintropt2041" width="620" height="465" /></p>
<h2><span style="color: #ff6600;">iCodeBlogGetsClassy.m:</span></h2>
<pre style="padding-left: 60px;">NSMutableArray *myArray = [[NSMutableArray alloc] init];</pre>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2042.png" alt="objectivec20anintropt2042" width="620" height="465" /></p>
<h2><span style="color: #ff6600;">iCodeBlogGetsClassy.m:</span></h2>
<pre style="padding-left: 60px;">	[myArray addObject:person1];
	[myArray addObject:person2];
	[myArray addObject:person3];
	[myArray addObject:person4];
	[myArray addObject:person5];
	[myArray addObject:person6];
	[myArray addObject:person7];
	[myArray addObject:person8];
	[myArray addObject:person9];
	[myArray addObject:person10];
	[myArray addObject:person11];
	[myArray addObject:person12];
	[myArray addObject:person13];</pre>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2043.png" alt="objectivec20anintropt2043" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2044.png" alt="objectivec20anintropt2044" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2045.png" alt="objectivec20anintropt2045" width="620" height="465" /></p>
<h2><span style="color: #ff6600;">iCodeBlogGetsClassy.m:</span></h2>
<pre style="padding-left: 60px;">	for(iCodeBlogClass *myObject in myArray)
	{
		NSLog(@"%@", myObject);
	}</pre>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2046.png" alt="objectivec20anintropt2046" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2047.png" alt="objectivec20anintropt2047" width="620" height="465" /></p>
<p><img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2048.png" alt="objectivec20anintropt2048" width="620" height="465" /></p>
<h2><span style="color: #ff6600;">iCodeBlogGetsClassy.m:</span></h2>
<pre style="padding-left: 60px;">-(NSString *)description
{
	return [NSString stringWithFormat:@"The name of the object is %@", self.name];
}
<img class="aligncenter size-full wp-image-1010" src="http://icodeblog.com/wp-content/uploads/2009/06/objectivec20anintropt2049.png" alt="objectivec20anintropt2049" width="620" height="465" /></pre>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/e8qFYgs0KrQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/06/29/objective-c-20-an-intro-part-2/feed/</wfw:commentRss>
<enclosure url="http://losectrl-gaincommand.com/iCodeBlogHelper/Tutorial4/ObjectiveC20AnIntroPart2.mov" length="213981579" type="video/quick" />
		<feedburner:origLink>http://icodeblog.com/2009/06/29/objective-c-20-an-intro-part-2/</feedburner:origLink></item>
		<item>
		<title>Using NSXMLParser to Pull UIImages From the Web</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/WEW5lhEZKfY/</link>
		<comments>http://icodeblog.com/2009/06/19/using-nsxmlparser-to-pull-uiimages-from-the-web/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 23:35:15 +0000</pubDate>
		<dc:creator>Collin</dc:creator>
		
		<category><![CDATA[Interface Builder]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[objective-c]]></category>

		<category><![CDATA[NSXMLParser]]></category>

		<category><![CDATA[UIImage]]></category>

		<category><![CDATA[UIScrollView]]></category>

		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=945</guid>
		<description><![CDATA[Introduction
Hello everyone, welcome to my third screeencast. This screencast is the result of a request made in the comments of my first post. I am going to be covering many topics in this post. But the general idea of the app we will build is that it will use an XML file online to get [...]]]></description>
			<content:encoded><![CDATA[<h1><span style="color: #ff6600;">Introduction</span></h1>
<p>Hello everyone, welcome to my third screeencast. This screencast is the result of a request made in the comments of my <a title="Creating a Custom UITableViewCell using Interface Builder" href="http://icodeblog.com/2009/05/24/custom-uitableviewcell-using-interface-builder/" target="_blank">first post</a>. I am going to be covering many topics in this post. But the general idea of the app we will build is that it will use an XML file online to get the URL and title of a given picture. For each URL and Title pair a view will be created with a UIImageView showing the image and a UILabel showing the title. Each of these views will be placed in a UIScrollView to flip through, like th functinoality of the Photos app.</p>
<h2><span style="color: #000000;">Skill Level</span> <span style="color: #ff6600;">Medium</span></h2>
<p>This app is going to require a decent amount of experience with Objective C and xCode. Also some minimal understanding of XML and XML schema/structure would be valuable.</p>
<h1><span style="color: #ff6600;">Source Code<br />
</span></h1>
<h3><a title="Using NSXMLParser to Pull UIImages from the Web" href="http://losectrl-gaincommand.com/iCodeBlogHelper/Tutorial3/iCodeBlogXMLImages.zip" onclick="pageTracker._trackPageview('/outgoing/losectrl-gaincommand.com/iCodeBlogHelper/Tutorial3/iCodeBlogXMLImages.zip?referer=');"><span style="text-decoration: underline;">Available Here</span></a></h3>
<h1><span style="color: #ff6600;">Screencast</span></h1>
<p>I film myself coding out the entire sample project for each post. I personally think going through the Screencast is the best way to learn. But feel free to look through the slides and text if that suites you better.</p>
<h3><a title="Using NSXMLParser to Pull UIImages from the Web" href="http://losectrl-gaincommand.com/iCodeBlogHelper/Tutorial3/Tutorial3.mov" onclick="pageTracker._trackPageview('/outgoing/losectrl-gaincommand.com/iCodeBlogHelper/Tutorial3/Tutorial3.mov?referer=');"><span style="text-decoration: underline;">Using NSXML to Pull UIImages From the Web Screencast</span></a></h3>
<h2><span style="color: #ff6600;">SCREENCAST ADDITION</span></h2>
<pre style="padding-left: 30px;">Adding a final line to layoutSubviews should be:</pre>
<pre style="padding-left: 30px;">     [scrollview setFrame:workingFrame];

this will stop the scroll view from bouncing up and down.</pre>
<h1><span style="color: #ff6600;">Tutorial</span></h1>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-947" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-32.png" alt="picture-32" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-948" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-41.png" alt="picture-41" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-949" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-5.png" alt="picture-5" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-950" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-61.png" alt="picture-61" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-951" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-71.png" alt="picture-71" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-952" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-81.png" alt="picture-81" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-953" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-91.png" alt="picture-91" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-954" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-101.png" alt="picture-101" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-955" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-111.png" alt="picture-111" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-956" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-121.png" alt="picture-121" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-957" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-131.png" alt="picture-131" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-958" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-141.png" alt="picture-141" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-959" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-151.png" alt="picture-151" width="620" height="387" /></span></p>
<h2><span style="color: #ff6600;">iCodeBlogXMLImagesViewController.h:</span></h2>
<pre style="padding-left: 60px;">@interface iCodeBlogXMLImagesViewController : UIViewController
{
	IBOutlet UIScrollView *scrollview;
}

@property (nonatomic, retain) IBOutlet UIScrollView *scrollview;</pre>
<h2><span style="color: #ff6600;">iCodeBlogXMLImagesViewController.m</span></h2>
<pre style="padding-left: 60px;">@synthesize scrollview;</pre>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-960" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-161.png" alt="picture-161" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-961" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-171.png" alt="picture-171" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-962" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-181.png" alt="picture-181" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-963" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-191.png" alt="picture-191" width="620" height="387" /></span></p>
<h2><span style="color: #ff6600;">iCodeBlogXMLView.h:</span></h2>
<pre style="padding-left: 60px;">@interface iCodeBlogXMLView : UIView
{
	IBOutlet UIImageView *imageView;
	IBOutlet UILabel *title;
}

@property (nonatomic, retain) IBOutlet UIImageView *imageView;
@property (nonatomic, retain) IBOutlet UILabel *title;

@end</pre>
<h2><span style="color: #ff6600;">iCodeBlogXMLView.m</span></h2>
<pre style="padding-left: 60px;">@synthesize imageView;
@synthesize title;</pre>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-964" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-201.png" alt="picture-201" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-965" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-211.png" alt="picture-211" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-966" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-221.png" alt="picture-221" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-967" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-23.png" alt="picture-23" width="620" height="387" /></span></p>
<h2><span style="color: #ff6600;">iCodeBlogXMLElement.h:</span></h2>
<pre style="padding-left: 60px;">@interface iCodeBlogXMLElement : NSObject
{
	UIImage *image;
	NSString *imageTitle;
}

@property (nonatomic, retain) UIImage *image;
@property (nonatomic, retain) NSString *imageTitle;

@end</pre>
<h2><span style="color: #ff6600;">iCodeBlogXMLElement.m</span></h2>
<pre style="padding-left: 60px;">@synthesize image;
@synthesize imageTitle;</pre>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-968" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-241.png" alt="picture-241" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-969" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-251.png" alt="picture-251" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-970" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-261.png" alt="picture-261" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-971" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-27.png" alt="picture-27" width="620" height="387" /></span></p>
<h2><span style="color: #ff6600;">iCodeBlogXMLImagesViewController.h:</span></h2>
<pre style="padding-left: 60px;">#import &lt;UIKit/UIKit.h&gt;
#import "iCodeBlogXMLElement.h"
#import "iCodeBlogXMLView.h"

@interface iCodeBlogXMLImagesViewController : UIViewController
{
	IBOutlet UIScrollView *scrollview;

	NSXMLParser *parser;
	NSMutableString *currentAttribute;
	NSMutableArray *xmlElementObjects;

	iCodeBlogXMLElement *tempElement;
}

@property (nonatomic, retain) IBOutlet UIScrollView *scrollview;

@property (nonatomic, retain) NSXMLParser *parser;
@property (nonatomic, retain) NSMutableString *currentAttribute;
@property (nonatomic, retain) NSMutableArray *xmlElementObjects;

@property (nonatomic, retain) iCodeBlogXMLElement *tempElement;

-(void)layoutSubview;

@end</pre>
<h2><span style="color: #ff6600;">iCodeBlogXMLImagesViewController.m</span></h2>
<pre style="padding-left: 60px;">@implementation iCodeBlogXMLImagesViewController

@synthesize scrollview;
@synthesize parser;
@synthesize currentAttribute;
@synthesize xmlElementObjects;
@synthesize tempElement;

...

- (void)viewDidLoad
{
    [super viewDidLoad];

	xmlElementObjects = [[NSMutableArray alloc] init];

	parser = [[NSXMLParser alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://losectrl-gaincommand.com/iCodeBlogHelper/Tutorial3/iCodeBlogImageXML.xml"]];
	[parser setDelegate:self];
	[parser parse];
}

...

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{

}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{

}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{

}</pre>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-972" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-281.png" alt="picture-281" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-973" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-291.png" alt="picture-291" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-974" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-301.png" alt="picture-301" width="620" height="387" /></span></p>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-975" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-311.png" alt="picture-311" width="620" height="387" /></span></p>
<h2><span style="color: #ff6600;">iCodeBlogXMLImagesViewController.m</span></h2>
<pre style="padding-left: 60px;">- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
	if(![elementName compare:@"PictureInfo"])
	{
		tempElement = [[iCodeBlogXMLElement alloc] init];
	}

	else if(![elementName compare:@"imageURL"])
	{
		currentAttribute = [NSMutableString string];
	}

	else if(![elementName compare:@"imageTitle"])
	{
		currentAttribute = [NSMutableString string];
	}
}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
	if(![elementName compare:@"PictureInfo"])
	{
		[xmlElementObjects addObject:tempElement];
	}

	else if(![elementName compare:@"imageURL"])
	{
		NSURL *imageURL = [NSURL URLWithString:currentAttribute];
		NSData *data =  [NSData dataWithContentsOfURL:imageURL];
		UIImage *image = [[UIImage alloc] initWithData:data];

		[tempElement setImage:image];
	}

	else if(![elementName compare:@"imageTitle"])
	{
		NSLog(@"The image title is %@", currentAttribute);
		[tempElement setImageTitle:currentAttribute];
	}

	else if(![elementName compare:@"Pictures"])
	{
		[self layoutSubview];
	}
}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
	if(self.currentAttribute)
	{
		[self.currentAttribute appendString:string];
	}
}</pre>
<p><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-976" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-321.png" alt="picture-321" width="622" height="388" /></span></p>
<h2><span style="color: #ff6600;">iCodeBlogXMLImagesViewController.m</span></h2>
<pre style="padding-left: 60px;"><span style="color: #ff6600;"><span style="color: #000000;">-(void)layoutSubview
{
	CGRect workingFrame;

	workingFrame.origin.x = 0;
	workingFrame.origin.y = 0;
	workingFrame.size.height = 480;
	workingFrame.size.width = 320;

	iCodeBlogXMLView *myView;

	for(iCodeBlogXMLElement *element in [self xmlElementObjects])
	{
		myView = [[iCodeBlogXMLView alloc] initWithFrame:workingFrame];

		NSLog(@"Element title is: %@", [element imageTitle]);

		NSArray *topLeveObjects = [[NSBundle mainBundle] loadNibNamed:@"iCodeBlogXMLView" owner:nil options:nil];

		for(id currentObject in topLeveObjects)
		{
			if([currentObject isKindOfClass:[iCodeBlogXMLView class]])
			{
				myView = (iCodeBlogXMLView *)currentObject;
			}
		}

		[[myView imageView] setImage:[element image]];
		[[myView title] setText:[element imageTitle]];
		[myView setFrame:workingFrame];

		[scrollview addSubview:myView];

		workingFrame.origin.x = workingFrame.origin.x + 320;
	}

	workingFrame.size.width = workingFrame.origin.x;
	[scrollview setContentSize:workingFrame.size];

	workingFrame.origin.x = 0;
	workingFrame.origin.y = 0;
	workingFrame.size.width = 320;
	workingFrame.size.height = 480;
}</span>

<img class="aligncenter size-large wp-image-996" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-33-1024x640.png" alt="picture-33" width="623" height="389" />
</span></pre>
<h2><span style="color: #ff6600;">iCodeBlogXMLImagesViewController.m</span></h2>
<pre>	parser = [[NSXMLParser alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://losectrl-gaincommand.com/iCodeBlogHelper/Tutorial3/iCodeBlogImageXMLB.xml"]];</pre>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/WEW5lhEZKfY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/06/19/using-nsxmlparser-to-pull-uiimages-from-the-web/feed/</wfw:commentRss>
<enclosure url="http://losectrl-gaincommand.com/iCodeBlogHelper/Tutorial3/Tutorial3.mov" length="232339793" type="video/quick" />
		<feedburner:origLink>http://icodeblog.com/2009/06/19/using-nsxmlparser-to-pull-uiimages-from-the-web/</feedburner:origLink></item>
		<item>
		<title>Objective C 2.0: An Intro - Part 1</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/ZXaW97PDNDw/</link>
		<comments>http://icodeblog.com/2009/06/18/objective-c-20-an-intro-part-1/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 18:15:08 +0000</pubDate>
		<dc:creator>Collin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=900</guid>
		<description><![CDATA[Introduction
Hello everyone, welcome to my second screeencast. This is going to be the first in a series of screencasts that are focused at people just beginning to work with Objective C and Cocoa. For many reasons the beginnings of learning cocoa development can be frusterating and lonely to a point. Only now is Objective C [...]]]></description>
			<content:encoded><![CDATA[<h3><span style="color: #ff6600;">Introduction</span></h3>
<p>Hello everyone, welcome to my second screeencast. This is going to be the first in a series of screencasts that are focused at people just beginning to work with Objective C and Cocoa. For many reasons the beginnings of learning cocoa development can be frusterating and lonely to a point. Only now is Objective C and Cocoa development gaining the kind of momentum to drive the creation of resources such as iCodeBlog and others.</p>
<h2><span style="color: #000000;">Skill Level</span> <span style="color: #008000;">Beginner</span></h2>
<p>This is not going to be a tutorial for someone who has never had any experience with programming. I aviod getting into the Object Oriented Methodology side of things. All you will need to know for this tutorail is generally the purpose of Classes, Methods and Objects. If you have done any work with Java, C, C++ or C# you should be able to follow the content no problem.</p>
<h1><span style="color: #ff6600;">Screencast</span></h1>
<p>I film myself coding out the entire sample project for each post. I personally think going through the Screencast is the best way to learn. But feel free to look through the slides and text if that suites you better.</p>
<h3><a title="Objective C 2.0: An Intro Part 1 Screencast" href="http://losectrl-gaincommand.com/iCodeBlogHelper/Tutorial2/Tutorial2.mov" target="_blank" onclick="pageTracker._trackPageview('/outgoing/losectrl-gaincommand.com/iCodeBlogHelper/Tutorial2/Tutorial2.mov?referer=');"><span style="text-decoration: underline;">Objective C 2.0: An Intro - Part 1</span></a></h3>
<h1><span style="color: #ff6600;">Tutorial</span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-902" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-3.png" alt="picture-3" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-903" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-4.png" alt="picture-4" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-904" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-6.png" alt="picture-6" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-905" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-7.png" alt="picture-7" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-907" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-9.png" alt="picture-9" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-908" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-10.png" alt="picture-10" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-909" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-11.png" alt="picture-11" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-910" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-12.png" alt="picture-12" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-911" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-13.png" alt="picture-13" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-912" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-14.png" alt="picture-14" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-913" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-15.png" alt="picture-15" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-914" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-16.png" alt="picture-16" width="620" height="387" /></span></h1>
<h2><span style="color: #ff6600;">Instructions</span></h2>
<ol>
<li><span style="color: #ff6600;"><span style="color: #000000;">Open xCode</span></span></li>
<li><span style="color: #ff6600;"><span style="color: #000000;">File -&gt; New Project</span></span></li>
<li><span style="color: #ff6600;"><span style="color: #000000;">Start a new View based iPhone Project. The type of project you create really doesn&#8217;t matter for this exercise since we will only be programming a for loop to print and not creating any User Interface.</span></span></li>
<li><span style="color: #ff6600;"><span style="color: #000000;">Call the project iCodeBlogCounter</span></span></li>
<li><span style="color: #ff6600;"><span style="color: #000000;">After saving the project you will be confronted with a screen looking something like this.</span></span></li>
<p><span style="color: #ff6600;"><span style="color: #000000;"><img class="aligncenter size-full wp-image-938" src="http://icodeblog.com/wp-content/uploads/2009/06/xcodefirstscreen.png" alt="xcodefirstscreen" width="620" height="387" /></span></span></p>
<li><span style="color: #ff6600;"><span style="color: #000000;">If you look in the top left hand corner you will see a folder called Classes. If you click the little black triangle to the left of the folder you will see what is included in the classes folder. In there you should see a class called iCodeBlogCounterAppDelegate.m. This is the file we will be working with. Click on it and you will see its contents appear in the editor window.</span></span></li>
<p><span style="color: #ff6600;"><span style="color: #000000;"><img class="aligncenter size-full wp-image-937" src="http://icodeblog.com/wp-content/uploads/2009/06/groupsandfilescloseup.png" alt="groupsandfilescloseup" width="280" height="275" /></span></span></p>
<li>We will be working with the - (void)applicationDidFinishLaunching:(UIApplication *)application  method. This method is called when the application finished launching. We will be entering some very simple code that will simple count from 0 to 99 and print the numbers in the terminal window. Here is what the method should look like:</li>
<p><span style="color: #ff6600;"><span style="color: #000000;"><img class="aligncenter size-full wp-image-935" src="http://icodeblog.com/wp-content/uploads/2009/06/applicationdidfinishlaunchingcloseup.png" alt="applicationdidfinishlaunchingcloseup" width="415" height="173" /></span></span></p>
<p><span style="color: #ff6600;"><span style="color: #000000;">The code here is:</span></span></p>
<pre><span style="color: #ff6600;"><span style="color: #000000;">for(int i = 0; i &lt; 100; i++)
{
     NSLog(@"The current number is: %d", i);
}
</span></span></pre>
<li><span style="color: #ff6600;"><span style="color: #000000;">That is all we need to do for this app. Now time to see it in action. To bring up the terminal window hit SHIFT + APPLE + R, this should bring up a blank window with maybe a line of text in it. Now click Build and Run or hit Apple + R. The terminal windows should say &#8220;The current number is 0&#8243; all the way to &#8220;The current  is 99&#8243;. Here is a screenshot of my window.</span></span></li>
</ol>
<p><span style="color: #ff6600;"><span style="color: #000000;"><img class="aligncenter size-full wp-image-936" src="http://icodeblog.com/wp-content/uploads/2009/06/counterterminalwindow.png" alt="counterterminalwindow" width="620" height="375" /><br />
</span></span></p>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-915" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-17.png" alt="picture-17" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-916" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-18.png" alt="picture-18" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-917" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-19.png" alt="picture-19" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-918" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-20.png" alt="picture-20" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-919" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-21.png" alt="picture-21" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-920" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-22.png" alt="picture-22" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-921" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-24.png" alt="picture-24" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-922" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-25.png" alt="picture-25" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-923" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-26.png" alt="picture-26" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-924" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-28.png" alt="picture-28" width="620" height="387" /></span></h1>
<h2><span style="color: #ff6600;">Instructions</span></h2>
<ol>
<li><span style="color: #ff6600;"><span style="color: #000000;">Open xCode</span></span></li>
<li><span style="color: #ff6600;"><span style="color: #000000;">File -&gt; New Project</span></span></li>
<li><span style="color: #ff6600;"><span style="color: #000000;">Start a new View based iPhone Project. The type of project you create really doesn&#8217;t matter for this exercise since we will only be programming a for loop to print and not creating any User Interface.</span></span></li>
<li><span style="color: #ff6600;"><span style="color: #000000;">Call the project iCodeBlogGetURLText</span></span></li>
<li><span style="color: #ff6600;"><span style="color: #000000;">Once the project is open go into the iCodeBlogURLTextAppDelegate.m file.</span></span></li>
<li><span style="color: #ff6600;"><span style="color: #000000;">Add this code to the </span></span>- (void)applicationDidFinishLaunching:(UIApplication *)application method</li>
<pre><span style="color: #ff6600;"><span style="color: #000000;">NSString *myURLString = @"http://losectrl-gaincommand.com/iCodeBlogHelper/Tutorial2/iCodeBlog.txt";
NSURL *myURL = [NSURL URLWithString:myURLString];
NSString *myString = [[NSString alloc] stringWithContentsofURL:myURL];

NSLog(@"The string from the internet is: %@", myString);
</span></span></pre>
<li><span style="color: #ff6600;"><span style="color: #000000;">If you bring up  the terminal window and Build and Run the App. You should see:</span></span></li>
</ol>
<p><span style="color: #ff6600;"><span style="color: #000000;"><img class="aligncenter size-full wp-image-942" src="http://icodeblog.com/wp-content/uploads/2009/06/urltextfileterminalwindow.png" alt="urltextfileterminalwindow" width="501" height="443" /><br />
</span></span></p>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-925" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-29.png" alt="picture-29" width="620" height="387" /></span></h1>
<h2><span style="color: #ff6600;">Instructions</span></h2>
<ol>
<li><span style="color: #ff6600;"><span style="color: #000000;">Go back to the code we just wrote.<br />
</span></span></li>
<li><span style="color: #ff6600;"><span style="color: #000000;">Erase the 4 lines of code we wrote and replace it with this line:</span></span></li>
<pre><span style="color: #ff6600;"><span style="color: #000000;">NSLog(@"The string from the internet is: %@", [[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://losectrl-gaincommand.com/iCodeBlogHelper/Tutorial2/iCodeBlog.txt"]]);
</span></span></pre>
<li>Running the application again should have the same output.</li>
<li>Here is a a breakdown of out new line of code.</li>
</ol>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-926" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-30.png" alt="picture-30" width="620" height="387" /></span></h1>
<h1><span style="color: #ff6600;"><img class="aligncenter size-full wp-image-927" src="http://icodeblog.com/wp-content/uploads/2009/06/picture-31.png" alt="picture-31" width="620" height="387" /></span></h1>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/ZXaW97PDNDw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/06/18/objective-c-20-an-intro-part-1/feed/</wfw:commentRss>
<enclosure url="http://losectrl-gaincommand.com/iCodeBlogHelper/Tutorial2/Tutorial2.mov" length="171823407" type="video/quick" />
		<feedburner:origLink>http://icodeblog.com/2009/06/18/objective-c-20-an-intro-part-1/</feedburner:origLink></item>
		<item>
		<title>iCodeBlog Vote: What Are Some New Tutorials You Would Like To See</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/puLE9sUgbEo/</link>
		<comments>http://icodeblog.com/2009/06/15/icodeblog-vote-what-are-some-new-tutorials-you-would-like-to-see/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 14:49:38 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=981</guid>
		<description><![CDATA[It&#8217;s voting time again on iCodeBlog.  We have learned quite a bit about programming for the iPhone over the last year or so and would love to share that knowledge with you.  I was trying to think of my next tutorial to post and then I had a thought to let the readers decide.
I know [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">It&#8217;s voting time again on iCodeBlog.  We have learned quite a bit about programming for the iPhone over the last year or so and would love to share that knowledge with you.  I was trying to think of my next tutorial to post and then I had a thought to let the readers decide.</p>
<p style="text-align: left;">I know you guys are all in the middle of the next iFart project and just need a little guidance on something to finish it up.  Well, now you have your chance to get advice on what you want to learn.  Let us know what type of tutorial you would like to see appear on iCodeBlog by voting below. In addition to casting your vote, leave you suggestion in the comments section of this post.</p>
<p style="text-align: left;">After some time (few days or so), I will look at the votes as well as the comments and come up with some new tutorials based on them. I already have a guess as to what will win, but this ought to be fun! Happy voting!</p>
<div class="advertisement-box">
<p style="text-align: center;">Note: There is a poll embedded within this post, please visit the site to participate in this post's poll.</p>
</div>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/puLE9sUgbEo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/06/15/icodeblog-vote-what-are-some-new-tutorials-you-would-like-to-see/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/06/15/icodeblog-vote-what-are-some-new-tutorials-you-would-like-to-see/</feedburner:origLink></item>
		<item>
		<title>RightSignature Featured on TechCrunch</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/0mSxAw2l2ig/</link>
		<comments>http://icodeblog.com/2009/06/01/rightsignature-featured-on-techcrunch/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 14:47:03 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[iPhone Articles]]></category>

		<category><![CDATA[iphone]]></category>

		<category><![CDATA[rightsignature]]></category>

		<category><![CDATA[techcrunch]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=897</guid>
		<description><![CDATA[
WOW, one of the apps we have been working on has been featured on TechCrunch.  The application is called RightSignature.  It allows you to digitally sign documents from any computer and your iPhone.  It&#8217;s a great piece of software that anyone who needs documents signed should definitely try out.  If you sign up through TechCrunch&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;"><a href="http://icodeblog.com/wp-content/uploads/2009/06/rightsignaturelogo.png"><img class="size-full wp-image-898 aligncenter" title="rightsignaturelogo" src="http://icodeblog.com/wp-content/uploads/2009/06/rightsignaturelogo.png" alt="rightsignaturelogo" width="225" height="72" /></a><br />
WOW, one of the apps we have been working on has been featured on <a href="http://www.techcrunch.com/2009/05/29/make-your-mark-rightsignature-lets-you-sign-documents-online-or-on-your-iphone/" onclick="pageTracker._trackPageview('/outgoing/www.techcrunch.com/2009/05/29/make-your-mark-rightsignature-lets-you-sign-documents-online-or-on-your-iphone/?referer=');">TechCrunch</a>.  The application is called RightSignature.  It allows you to digitally sign documents from any computer and your iPhone.  It&#8217;s a great piece of software that anyone who needs documents signed should definitely try out.  If you sign up through <a href="http://www.techcrunch.com/2009/05/29/make-your-mark-rightsignature-lets-you-sign-documents-online-or-on-your-iphone/" onclick="pageTracker._trackPageview('/outgoing/www.techcrunch.com/2009/05/29/make-your-mark-rightsignature-lets-you-sign-documents-online-or-on-your-iphone/?referer=');">TechCrunch&#8217;s link</a> you can get 2 months free of the premium service. Can&#8217;t beat that!</p>
<p style="text-align: left;">So be sure to check out <a href="http://rightsignature.com" onclick="pageTracker._trackPageview('/outgoing/rightsignature.com?referer=');">RightSignature!</a></p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/0mSxAw2l2ig" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/06/01/rightsignature-featured-on-techcrunch/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/06/01/rightsignature-featured-on-techcrunch/</feedburner:origLink></item>
		<item>
		<title>Custom UITableViewCell Using Interface Builder</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/yDMsaZPm-UI/</link>
		<comments>http://icodeblog.com/2009/05/24/custom-uitableviewcell-using-interface-builder/#comments</comments>
		<pubDate>Mon, 25 May 2009 03:27:36 +0000</pubDate>
		<dc:creator>Collin</dc:creator>
		
		<category><![CDATA[Interface Builder]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[iPhone Articles]]></category>

		<category><![CDATA[iPhone Programming Tutorials]]></category>

		<category><![CDATA[iphone]]></category>

		<category><![CDATA[objective-c]]></category>

		<category><![CDATA[uitableview]]></category>

		<category><![CDATA[UITableViewCell]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=752</guid>
		<description><![CDATA[Hey everyone, welcome to my first of many screencasts coming in the next few weeks. Today I am going to show you how to layout a UITableViewCell in Interface Builder and have a UITableView populate with those type of cells. I am adopting a new structure for my screencasts which will be 5 or so [...]]]></description>
			<content:encoded><![CDATA[<p>Hey everyone, welcome to my first of many screencasts coming in the next few weeks. Today I am going to show you how to layout a UITableViewCell in Interface Builder and have a UITableView populate with those type of cells. I am adopting a new structure for my screencasts which will be 5 or so mintues of keynote slides giving background info followed by 20 - 25 mintues of step by step development. The entire video will be directly below this paragraph, but scrolling down you will see a text based step by step of the whole tutorial as well. Hope you guys enjoy.</p>
<h2><span style="color: #000000;">Skill Level</span> <span style="color: #ff6600;">MEDIUM</span></h2>
<p>Here is a link to the screencast to watch. We are working on getting an embedded version in, but I figure this is basically just as functional. Have fun!</p>
<h2><a href="http://eu-video-cloud.s3.amazonaws.com/available/114103480/asset-61/encoded_hidef.mp4" onclick="pageTracker._trackPageview('/outgoing/eu-video-cloud.s3.amazonaws.com/available/114103480/asset-61/encoded_hidef.mp4?referer=');">Custom UITableViewCell Screencast Video</a></h2>
<h1><span style="color: #ff6600;">Source Code<br />
</span></h1>
<h3><a title="Custom UITableViewCell's Using Interface Builder" href="http://losectrl-gaincommand.com/iCodeBlogHelper/Tutorial1/CustomUITableViewCell.zip" onclick="pageTracker._trackPageview('/outgoing/losectrl-gaincommand.com/iCodeBlogHelper/Tutorial1/CustomUITableViewCell.zip?referer=');"><span style="text-decoration: underline;">Available Here</span></a></h3>
<h2><span style="color: #008080;">Background Information</span></h2>
<p><img class="aligncenter size-full wp-image-814" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-1.png" alt="picture-1" width="622" height="388" /></p>
<p><img class="aligncenter size-full wp-image-815" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-2.png" alt="picture-2" width="622" height="388" /></p>
<p><img class="aligncenter size-full wp-image-816" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-3.png" alt="picture-3" width="622" height="388" /></p>
<p><img class="aligncenter size-full wp-image-817" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-4.png" alt="picture-4" width="622" height="388" /></p>
<p><img class="aligncenter size-full wp-image-818" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-5.png" alt="picture-5" width="622" height="388" /></p>
<p><img class="aligncenter size-full wp-image-819" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-6.png" alt="picture-6" width="622" height="388" /></p>
<p><img class="aligncenter size-full wp-image-820" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-7.png" alt="picture-7" width="622" height="388" /></p>
<p><img class="aligncenter size-full wp-image-821" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-8.png" alt="picture-8" width="622" height="388" /></p>
<p><img class="aligncenter size-full wp-image-822" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-9.png" alt="picture-9" width="622" height="388" /></p>
<p><img class="aligncenter size-full wp-image-823" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-10.png" alt="picture-10" width="622" height="388" /></p>
<p><img class="aligncenter size-full wp-image-824" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-11.png" alt="picture-11" width="622" height="388" /></p>
<h2><span style="color: #008080;">Building The App</span></h2>
<h3><span style="color: #008080;"><span style="color: #993300;">Step 1</span></span></h3>
<p><img class="aligncenter size-full wp-image-825" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-12.png" alt="picture-12" width="622" height="388" /></p>
<p style="padding-left: 60px;"><span style="color: #008080;"><span style="color: #993300;"><span style="color: #000000;">This step shouldn&#8217;t require any extra information.</span></span></span></p>
<h3><span style="color: #008080;"><span style="color: #993300;">Step 2</span></span></h3>
<p><img class="aligncenter size-full wp-image-826" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-13.png" alt="picture-13" width="622" height="388" /></p>
<p><img class="aligncenter size-full wp-image-836" src="http://icodeblog.com/wp-content/uploads/2009/05/datasourceconnection.png" alt="datasourceconnection" width="622" height="377" /></p>
<h3><span style="color: #008080;"><span style="color: #993300;">Step 3</span></span></h3>
<p><img class="aligncenter size-full wp-image-827" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-14.png" alt="picture-14" width="622" height="388" /></p>
<p style="padding-left: 30px;">In CustomTableCellTutorialViewController.m you must define the two required UITableViewDataSource methods. These methods will fill up the table view with data. For now we will put in dummy data just to make sure all of our connections are working.</p>
<p style="padding-left: 30px;">- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section</p>
<p style="padding-left: 30px;">{</p>
<p style="padding-left: 60px;">return 10;</p>
<p style="padding-left: 30px;">}</p>
<p style="padding-left: 30px;">- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath</p>
<p style="padding-left: 30px;">{</p>
<p style="padding-left: 60px;">static NSString *CellIdentifier = @&#8221;Cell&#8221;;</p>
<p style="padding-left: 60px;">UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];</p>
<p style="padding-left: 60px;">if (cell == nil){</p>
<p style="padding-left: 90px;">cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];</p>
<p style="padding-left: 60px;">}</p>
<p style="padding-left: 60px;">[cell setText:[NSString stringWithFormat:@"I am cell %d", indexPath.row]];</p>
<p style="padding-left: 60px;">return cell;</p>
<p style="padding-left: 30px;">}</p>
<h3><span style="color: #008080;"><span style="color: #993300;">Step 4</span></span></h3>
<p><img class="aligncenter size-full wp-image-828" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-15.png" alt="picture-15" width="622" height="388" /></p>
<p style="padding-left: 30px;">Here you will need to be in xCode and go to File -&gt; New File&#8230;</p>
<p style="padding-left: 30px;">Select Objective C Class and make sure it is a UITableViewCell subclass, depending on your version of the SDK selecting this will differ. Look around and you will find it, call it iCodeBlogCustomCell. With this done enter these IBOutlets in the iCodeBlogCustomCell.h file enter the following IBOutlets:</p>
<p style="padding-left: 30px;">IBOutlet UILabel *articleName;<br />
IBOutlet UILabel *authorName;<br />
IBOutlet UILabel *date;</p>
<p>IBOutlet UIImageView *imageView;<br />
IBOutlet UIView *viewForBackground;</p>
<p style="padding-left: 30px;">Add the @property and synthesize them in the main.</p>
<h3><span style="color: #008080;"><span style="color: #993300;">Step 5</span></span></h3>
<p><img class="aligncenter size-full wp-image-829" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-16.png" alt="picture-16" width="622" height="388" /></p>
<p style="padding-left: 30px;">This step does not require and code but does require a lot of work in Interface Builder. I highly recommend you watch the screencast to see the step by step procedure here. Essentially what I do is create a new View XIB file. Opening this, I delete the standard UIView in the XIB and drag a UITableViewCell from my library into my document window. I assign the UITableViewCell to be of type iCodeBlogCustomCell. With this done layout the interface with the proper elements and hook them up by right clicking on the UITableViewCell in the document window.</p>
<h3><span style="color: #008080;"><span style="color: #993300;">Step 6<br />
</span></span></h3>
<p><img class="aligncenter size-full wp-image-830" src="http://icodeblog.com/wp-content/uploads/2009/05/picture-17.png" alt="picture-17" width="622" height="388" /></p>
<p style="padding-left: 30px;">This is where the real magic is. We are going to return to CustomTableCellTutorialViewController.m and edit the UITableViewDataSource methods we implemented earlier. The code I use has me putting in 4 separate PNG files that I add to my project. You can find your own to put inside the cells. Make sure the UIImageView inside the cell is set for Aspect Fit so you don&#8217;t have to worry about resizing the images.  The functions should be changed to be:</p>
<p style="padding-left: 30px;">- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section<br />
{<br />
return 100;<br />
}</p>
<p style="padding-left: 30px;">- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath<br />
{<br />
static NSString *CellIdentifier = @&#8221;iCodeBlogCustomCell&#8221;;</p>
<p style="padding-left: 60px;">iCodeBlogCustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];</p>
<p style="padding-left: 60px;">if (cell == nil){<br />
NSLog(@&#8221;New Cell Made&#8221;);</p>
<p style="padding-left: 60px;">NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@&#8221;iCodeBlogCustomCell&#8221; owner:nil options:nil];</p>
<p style="padding-left: 60px;">for(id currentObject in topLevelObjects)<br />
{<br />
if([currentObject isKindOfClass:[iCodeBlogCustomCell class]])<br />
{<br />
cell = (iCodeBlogCustomCell *)currentObject;<br />
break;<br />
}<br />
}<br />
}</p>
<p style="padding-left: 60px;">
<p style="padding-left: 60px;">if(indexPath.row % 4 == 0)<br />
{<br />
[[cell authorName] setText:@&#8221;Collin Ruffenach&#8221;];<br />
[[cell articleName] setText:@&#8221;Test Article 1&#8243;];<br />
[[cell date] setText:@&#8221;May 5th, 2009&#8243;];<br />
[[cell imageView] setImage:[UIImage imageNamed:@"1.png"]];<br />
}</p>
<p style="padding-left: 60px;">else if(indexPath.row % 4 == 1)<br />
{<br />
[[cell authorName] setText:@&#8221;Steve Jobs&#8221;];<br />
[[cell articleName] setText:@&#8221;Why iPhone will rule the world&#8221;];<br />
[[cell date] setText:@&#8221;May 5th, 2010&#8243;];<br />
[[cell imageView] setImage:[UIImage imageNamed:@"2.png"]];<br />
}</p>
<p style="padding-left: 60px;">else if(indexPath.row % 4 == 2)<br />
{<br />
[[cell authorName] setText:@&#8221;The Woz&#8221;];<br />
[[cell articleName] setText:@&#8221;Why I&#8217;m coming back to Apple&#8221;];<br />
[[cell date] setText:@&#8221;May 5th, 2012&#8243;];<br />
[[cell imageView] setImage:[UIImage imageNamed:@"3.png"]];<br />
}</p>
<p style="padding-left: 60px;">else if(indexPath.row % 4 == 3)</p>
<p style="padding-left: 60px;">{<br />
[[cell authorName] setText:@&#8221;Aaron Hillegass&#8221;];<br />
[[cell articleName] setText:@&#8221;Cocoa: A Brief Introduction&#8221;];<br />
[[cell date] setText:@&#8221;May 5th, 2004&#8243;];<br />
[[cell imageView] setImage:[UIImage imageNamed:@"4.png"]];</p>
<p style="padding-left: 60px;">}</p>
<p style="padding-left: 30px;">return cell;<br />
}</p>
<h3><span style="color: #008080;"><span style="color: #993300;">The End</span></span></h3>
<p style="padding-left: 30px;">So that is it for my first new post. I will be doing many more. Let me know your thoughts on this format in the comments. If you see anything organization wise that you think should be changed/add/removed let me know. Good Luck!</p>
<p style="padding-left: 30px;">
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/yDMsaZPm-UI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/05/24/custom-uitableviewcell-using-interface-builder/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/05/24/custom-uitableviewcell-using-interface-builder/</feedburner:origLink></item>
		<item>
		<title>Great Tutorial Series on OpenGL ES</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/s-oNddYEqr0/</link>
		<comments>http://icodeblog.com/2009/05/20/great-tutorial-series-on-opengl-es/#comments</comments>
		<pubDate>Wed, 20 May 2009 20:07:49 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[iPhone Articles]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=873</guid>
		<description><![CDATA[Jeff Lamarche author of the book &#8220;Beginning iPhone Development&#8221; has written (and is currently writing) a brilliant series on OpenGL ES.  He does an incredibly job of simplifying the complex ideas behind working in 3D and makes learning OpenGL ES easy for even a novice programmer.
I have always struggled with OpenGL as 3D has a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html" onclick="pageTracker._trackPageview('/outgoing/iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html?referer=');"><img class="alignleft" title="OpenGL ES" src="http://lh6.ggpht.com/_QLwms0mVa4w/SgsbyhmQyuI/AAAAAAAAATw/aOtlJuYsOY8/iPhone%20SimulatorScreenSnapz007.jpg?imgmax=800" alt="" width="208" height="400" /></a>Jeff Lamarche author of the book &#8220;Beginning iPhone Development&#8221; has written (and is currently writing) a <a href="http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html" onclick="pageTracker._trackPageview('/outgoing/iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html?referer=');">brilliant series on OpenGL ES</a>.  He does an incredibly job of simplifying the complex ideas behind working in 3D and makes learning OpenGL ES easy for even a novice programmer.</p>
<p>I have always struggled with OpenGL as 3D has a lot of nerdy math, this series breaks it down into the simplest of forms and helped me tremendously. So go check it out and let me know what you think.</p>
<p><a href="http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html" onclick="pageTracker._trackPageview('/outgoing/iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html?referer=');">http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html</a></p>
<p>Jeff is also on Twitter<a href="http://twitter.com/jeff_lamarche" onclick="pageTracker._trackPageview('/outgoing/twitter.com/jeff_lamarche?referer=');">@jeff_lamarche</a></p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/s-oNddYEqr0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/05/20/great-tutorial-series-on-opengl-es/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/05/20/great-tutorial-series-on-opengl-es/</feedburner:origLink></item>
		<item>
		<title>EyeCue relaunched!</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/A8I-YmsiGRg/</link>
		<comments>http://icodeblog.com/2009/05/11/eyecue-relaunched/#comments</comments>
		<pubDate>Mon, 11 May 2009 21:55:13 +0000</pubDate>
		<dc:creator>rhou</dc:creator>
		
		<category><![CDATA[AppStore]]></category>

		<category><![CDATA[iphone]]></category>

		<category><![CDATA[apple]]></category>

		<category><![CDATA[EyeCue]]></category>

		<category><![CDATA[game]]></category>

		<category><![CDATA[itunes]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=784</guid>
		<description><![CDATA[EyeCue relaunched on iTunes! EyeCue has received tremendous amount of success since its original launch. We have had thousands of downloads on the daily basis. Unfortunately, quite a few users experienced crashes due to the compatibility issues in iPhone SDK 2.1 and iPhone SDK 2.2.
]]></description>
			<content:encoded><![CDATA[<div class="preface">
<p>EyeCue has received tremendous amount of success since its original launch.  We have had thousands of downloads on the daily basis.  Unfortunately, quite a few users experienced crashes due to the compatibility issues in iPhone SDK 2.1 and iPhone SDK 2.2.</p>
<p>In an effort the combat the incompatibility issue, we&#8217;ve recompiled the code and re-released the new and updated version in iTunes.</p>
<p>I have even made a video for it.  Check it out <a href="http://www.youtube.com/watch?v=-JxZpfzhV2Y" onclick="pageTracker._trackPageview('/outgoing/www.youtube.com/watch?v=-JxZpfzhV2Y&amp;referer=');">here</a></p>
<p>Get your copy <a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=308416341&amp;mt=8" onclick="pageTracker._trackPageview('/outgoing/itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=308416341_amp_mt=8&amp;referer=');">here</a></p>
<p>Giddy up!</p></div>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/A8I-YmsiGRg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/05/11/eyecue-relaunched/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/05/11/eyecue-relaunched/</feedburner:origLink></item>
		<item>
		<title>Hello Everyone</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/nFkjivBWgk0/</link>
		<comments>http://icodeblog.com/2009/05/08/hello-everyone/#comments</comments>
		<pubDate>Fri, 08 May 2009 20:14:33 +0000</pubDate>
		<dc:creator>Collin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Bio]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=737</guid>
		<description><![CDATA[Hi there. My name is Collin Ruffenach and I am going to be posting several new iCodeBlog Screencasts in the next few weeks. I have been an avid Apple user for the last 5 years and for the last 3 have really focused on improving my Objective C/Cocoa Skills. I am currently working on several [...]]]></description>
			<content:encoded><![CDATA[<p>Hi there. My name is Collin Ruffenach and I am going to be posting several new iCodeBlog Screencasts in the next few weeks. I have been an avid Apple user for the last 5 years and for the last 3 have really focused on improving my Objective C/Cocoa Skills. I am currently working on several application to be released in the store with the iPhone 3.0 software. Currently I am a Masters CS student at Arizona State University working on several iPhone development projects for varying studies around the university.</p>
<p>Long time readers may remember a post I did back in <a title="Using a UISegmentedControl with a UITableView" href="http://icodeblog.com/2008/10/13/iphone-programming-tutorial-using-tabbarview-to-switch-between-views/" target="_blank">October</a> of last year. I was still fairly new to the SDK then and now have the skills required to make many screencasts on varying topics and tailored to many skill levels. I am going to be implementing something new in my posts to dictate the difficulty of a screencast. With the first minute you will see an overview of the skills needed to get through the screencast. I have several in mind, including a few dealing with API&#8217;s made available within the 3.0 SDK. These lessons will be posted as soon as the NDA (Non Disclosure Agreement) is removed on the 3.0 software.</p>
<p>My first post will be coming in the next few days, but anyone with requests for screencast topics please post them here. I will pick some I think I can do and get them up for you guys in the next few weeks. Also if please use the commenting systems on the screencasts, I read every comment and really try to focus on any pointed out problems. Thanks, you&#8217;ll be seeing some stuff from me soon.</p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/nFkjivBWgk0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/05/08/hello-everyone/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/05/08/hello-everyone/</feedburner:origLink></item>
		<item>
		<title>iPhone Game Programming Tutorial Part 4 - Basic Game Audio</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/NTGNwYX2r-4/</link>
		<comments>http://icodeblog.com/2009/05/04/iphone-game-programming-tutorial-part-4-basic-game-audio/#comments</comments>
		<pubDate>Mon, 04 May 2009 23:47:30 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[iPhone Game Programming]]></category>

		<category><![CDATA[iPhone Programming Tutorials]]></category>

		<category><![CDATA[iphone development]]></category>

		<category><![CDATA[iphone game programming tutorial]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=719</guid>
		<description><![CDATA[Ok, I will be finishing up this series by showing you guys how to add basic audio to your game.  Since this is a beginner tutorial, I won&#8217;t go into complex audio using OpenAL or Audio Queues.  Today, we will just be playing short sounds (less than 30 seconds).  This will be the easiest way [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, I will be finishing up this series by showing you guys how to add basic audio to your game.  Since this is a beginner tutorial, I won&#8217;t go into complex audio using OpenAL or Audio Queues.  Today, we will just be playing short sounds (less than 30 seconds).  This will be the easiest way to do audio if you don&#8217;t require any background music (I guess you could do a nasty hack and loop a 30 sec clip but that would be shameful <img src='http://icodeblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ).  The downfall of doing audio this way is only one audio file can be playing at a time.  Ok, let&#8217;s get started&#8230; Make sure you are starting with the base code from the <a href="http://icodeblog.com/2009/03/18/iphone-game-programming-tutorial-part-3-splash-screen/">previous tutorial</a> (either use yours or download a fresh copy).  We will be using 2 sounds today, 1 for when the ball is hit and another for when someone scores a point.</p>
<p>Here are the sound files you will need to download for this tutorial:</p>
<ul>
<li><a style="text-decoration: none;" href="http://icodeblog.com/wp-content/uploads/2009/05/clapping-crowd-studio-01.caf">clapping-crowd-studio-01</a></li>
<li><a href="http://icodeblog.com/wp-content/uploads/2009/05/tennis-volley-01.caf">tennis-volley-01</a></li>
</ul>
<p>Notice that all of the audio files have a .caf extension.  This is the audio type all of your sound files must be in to be played by the iPhone.  Luckily Apple has provided us a utility for converting audio to this format. You can read up on it <a href="http://developer.apple.com/iphone/prerelease/library/codinghowtos/AudioAndVideo/index.html#PROCESSING-CONVERT_AN_AUDIO_FILE_TO_THE_PREFERRED_FORMAT_FOR_IPHONE_OS" onclick="pageTracker._trackPageview('/outgoing/developer.apple.com/iphone/prerelease/library/codinghowtos/AudioAndVideo/index.html_PROCESSING-CONVERT_AN_AUDIO_FILE_TO_THE_PREFERRED_FORMAT_FOR_IPHONE_OS?referer=');">here</a>.  It&#8217;s pretty straight forward, just open up a Terminal and type</p>
<p><strong>/usr/bin/afconvert -f caff -d LEI16 {INPUT} {OUTPUT}</strong></p>
<p>Where {INPUT} is the path to your input audio file and {OUTPUT} is the file you want it to save it to with a .caf extension.</p>
<h2>Adding the Audio Files To You Project</h2>
<p>Start by downloading these files.  Then drag them to your Resources Folder inside of your project.  You may also want to add a subfolder called Audio to keep organized. Make sure you check the box to copy the files into your project&#8217;s directory.</p>
<p style="text-align: center;"><a href="http://icodeblog.com/wp-content/uploads/2009/05/screenshot_01.png"><img class="alignnone size-full wp-image-724" title="screenshot_01" src="http://icodeblog.com/wp-content/uploads/2009/05/screenshot_01.png" alt="screenshot_01" width="232" height="240" /></a></p>
<h2>Add The AudioToolbox.framework to Your Project</h2>
<p>Since we need to call functions within this framework, we will need to add it to our project. The best way I have found to locate a framework on my mac is to search for it.<span style="white-space:pre"> </span> Right Click on the <strong>Frameworks</strong> folder in your project and select <strong>Add -&gt; Existing Frameworks</strong>.  In the search box type <strong>AudioToolbox.framework </strong> and select the framework among the search results. (Make sure you have <strong>Computer</strong> selected to search your entire computer)</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/05/screenshot_02.png"><img class="alignnone size-full wp-image-725" title="screenshot_02" src="http://icodeblog.com/wp-content/uploads/2009/05/screenshot_02.png" alt="screenshot_02" width="532" height="427" /></a></p>
<p style="text-align: left; ">When you find it, click <strong>Add.</strong> We are now ready to start coding&#8230;</p>
<h2>Add the Header Declarations</h2>
<p>Open up <strong>iTennisViewController.h</strong> and add the following code.</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/05/screenshot_11.png"><img class="alignnone size-full wp-image-729" title="screenshot_11" src="http://icodeblog.com/wp-content/uploads/2009/05/screenshot_11.png" alt="screenshot_11" width="325" height="356" /></a></p>
<p style="text-align: left; ">First we see an import for the AudioServices.h. This is needed to call the functions required for us to play audio.  Next, we declare 2 SystemSoundID&#8217;s.  These are basically just Integers (could actually use an int instead but you&#8217;d get a warning).  Next, open up <strong>iTennishViewController.m</strong> and add the following code to synthesize these variables.</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/05/screenshot_09.png"><img class="alignnone size-full wp-image-728" title="screenshot_09" src="http://icodeblog.com/wp-content/uploads/2009/05/screenshot_09.png" alt="screenshot_09" width="258" height="27" /></a></p>
<p style="text-align: left; ">Now let&#8217;s initialize our sounds objects.  Go to the viewDidLoad method and add the following code.</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/05/screenshot_12.png"><img class="size-full wp-image-730 aligncenter" title="screenshot_12" src="http://icodeblog.com/wp-content/uploads/2009/05/screenshot_12.png" alt="screenshot_12" width="709" height="223" /></a></p>
<p style="text-align: left; ">
<p style="text-align: left; ">
<p style="text-align: left; ">
<p style="text-align: left; ">Pretty straight forward.  The first line gets the path of the audio file.  The next line converts the path to a CFURLRef.  Finally, we load that audio file and associate it with the given sound ID. Notice we pass &amp;clappingFileID.  This is a pass by reference and allows the AudioServicesCreateSystemSoundID method to modify this variable.  We do the same thing to load the volley sound.  Now, let&#8217;s play the sounds.</p>
<h2>Playing The Sounds</h2>
<p>It&#8217;s actually quite simple to play the sounds we have loaded.  Simply call the AudioServicesPlaySystemSound method and pass it the soundID of the file you want to play.  So to play the clapping sound when someone scores, add this code to your reset method.</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/05/screenshot_14.png"><img class="alignnone size-full wp-image-731" title="screenshot_14" src="http://icodeblog.com/wp-content/uploads/2009/05/screenshot_14.png" alt="screenshot_14" width="322" height="52" /></a></p>
<p style="text-align: left; ">Notice, we are passing the clappingFileID to indicate we want to play the clapping sound.  Now, add the following code to gameLoop to play the racquet sound when someone hits the ball.</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/05/screenshot_15.png"><img class="alignnone size-full wp-image-732" title="screenshot_15" src="http://icodeblog.com/wp-content/uploads/2009/05/screenshot_15.png" alt="screenshot_15" width="381" height="209" /></a></p>
<p style="text-align: left; ">Pretty straight forward Right? Now click Build and Go and check out the game audio.  That concludes this tutorial.  If you have any questions or comments, feel free to leave them in the comments section of this post or write them to me on <a href="http://twitter.com/brandontreb" onclick="pageTracker._trackPageview('/outgoing/twitter.com/brandontreb?referer=');">Twitter</a>.  You can also download the sample code <a href="http://icodeblog.com/wp-content/uploads/2009/05/itennis-4.zip">here</a></p>
<p>Happy iCoding!</p>
<p style="text-align: left; ">
<p style="text-align: left; ">
<p style="text-align: left;">
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/NTGNwYX2r-4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/05/04/iphone-game-programming-tutorial-part-4-basic-game-audio/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/05/04/iphone-game-programming-tutorial-part-4-basic-game-audio/</feedburner:origLink></item>
		<item>
		<title>iPhone Game Programming Tutorial Part 3 - Splash Screen</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/OYvchr7MS6g/</link>
		<comments>http://icodeblog.com/2009/03/18/iphone-game-programming-tutorial-part-3-splash-screen/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 20:01:04 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[iPhone Game Programming]]></category>

		<category><![CDATA[iPhone Programming Tutorials]]></category>

		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=703</guid>
		<description><![CDATA[Ok, So it&#8217;s time to wrap up this series.  Today I will be showing you how to add a few &#8220;bells and whistles&#8221; that will make your game more complete.  Let&#8217;s start by adding a splash screen to your game (Again I truly apologize for the lack of graphics skillz. Photoshop and I are not friends).
Creating a [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, So it&#8217;s time to wrap up this series.  Today I will be showing you how to add a few &#8220;bells and whistles&#8221; that will make your game more complete.  Let&#8217;s start by adding a splash screen to your game (Again I truly apologize for the lack of graphics skillz. Photoshop and I are not friends).</p>
<h3>Creating a Splash Page</h3>
<p>We will be adding a splash page that will fade out into our main game screen.  Start by downloading this image and adding it to your project&#8217;s <strong>Resources</strong> Folder. Make sure you check the box to copy this image to the project&#8217;s directory.</p>
<p style="text-align: center;"><a href="http://icodeblog.com/wp-content/uploads/2009/03/splash.png"><img class="alignnone size-full wp-image-704" title="splash" src="http://icodeblog.com/wp-content/uploads/2009/03/splash.png" alt="splash" width="320" height="480" /></a></p>
<p style="text-align: left;">Now we need to add a View Controller to our project that will handle the Splash View.  Go ahead and add a new file to your project that is a <strong>UIViewController </strong>subclass. Name this file <strong>SplashViewController.</strong> Make sure you check to create the .h file as well.</p>
<p style="text-align: left;">
<div style="text-align: center;"><a href="http://icodeblog.com/wp-content/uploads/2009/03/screenshot_01.png"><img class="alignnone size-full wp-image-705" title="screenshot_01" src="http://icodeblog.com/wp-content/uploads/2009/03/screenshot_01.png" alt="screenshot_01" width="600" height="442" /></a></div>
<div style="text-align: left;">Next, we need to change our AppDelegate to load this view controller instead of our main view controller.  Open up <strong>iTennisAppDelegate.h </strong>and change it to look like this:</div>
<div style="text-align: center;"><a href="http://icodeblog.com/wp-content/uploads/2009/03/screenshot_02.png"><img class="alignnone size-full wp-image-706" title="screenshot_02" src="http://icodeblog.com/wp-content/uploads/2009/03/screenshot_02.png" alt="screenshot_02" width="466" height="194" /></a></div>
<div style="text-align: left;">We are basically replacing iTennisViewController with SplashViewController.  Next, open up <strong>iTennisAppDelegate.m </strong>and change it to look like this:</div>
<div style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/03/screenshot_03.png"><img class="alignnone size-full wp-image-707" title="screenshot_03" src="http://icodeblog.com/wp-content/uploads/2009/03/screenshot_03.png" alt="screenshot_03" width="418" height="365" /></a></div>
<div style="text-align: left; ">Again, all we are really doing is changeing iTennisViewController with SplashViewController.  This is because we want to load the splash page initially and not the main game screen.  One main difference to note here is we are allocating a new instance of the SplashViewController. We didn&#8217;t have to do that with the iTennisViewController because it was being loaded from a nib and our application initialized it for us.  Since we are building SplashViewController programatically (without a nib), we need to instantiate it.  Next, let&#8217;s implement the Splash View.  Open up <strong>SplashViewController.h</strong> and add the following code:</div>
<div style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/03/screenshot_04.png"><img class="alignnone size-full wp-image-708" title="screenshot_04" src="http://icodeblog.com/wp-content/uploads/2009/03/screenshot_04.png" alt="screenshot_04" width="406" height="231" /></a></div>
<div style="text-align: left; ">Let me explain what&#8217;s going on here.  First, we see an NSTimer.  This will be used to display the splash page for a certain amount of time before fading to our main game screen.  Next, there is a UIImageView.  This will simply be the imageview of our splash image.</div>
<div style="text-align: left; ">Finally, we see the <strong>iTennisViewController</strong>.  This is the view controller that we replaced inside of our application&#8217;s delegate.  We will be loading it from our splash view. Now, open up <strong>SplashViewController.m</strong> and add the following code:</div>
<div style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/03/screenshot_05.png"><img class="alignnone size-full wp-image-709" title="screenshot_05" src="http://icodeblog.com/wp-content/uploads/2009/03/screenshot_05.png" alt="screenshot_05" width="301" height="25" /></a></div>
<div style="text-align: left; ">This is just synthesizing all of our properties.  Now, add the following code to our <strong>l</strong><strong>oadView</strong> method:</div>
<div style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/03/screenshot_07.png"><img class="alignnone size-full wp-image-711" title="screenshot_07" src="http://icodeblog.com/wp-content/uploads/2009/03/screenshot_07.png" alt="screenshot_07" width="761" height="259" /></a></div>
<div style="text-align: left; ">Lot&#8217;s of new code here.  First off, since we are loading this view programatically without a nib, we have to create the view.  So we get the frame that the application is running in and use it to allocate a new view.  Then we set the view of the SplashViewController to this newly created view.  We have to create the frame to basically tell the application to create a view that is 320&#215;480.</div>
<div style="text-align: left; ">The next thing we do is create the splashImageView from the Splash.png image.  We also need to create a frame for this images.  Think of a frame as an empty container that we will put our image in.  Next we add the imageview to our main view.  This will display it immediately.</div>
<div style="text-align: left; ">Next, we initialize our view main controller by passing it the nib it will load from.  Next, the view&#8217;s alpha transparency is set to 0.0.  This makes it completely invisible.  Finally, we add it to our view.  Note that it is on top of the splashimageview but is not visible because the alpha transparency is set to 0.0.</div>
<div style="text-align: left; ">Finally, we start the timer.  This will show the splash screen for 2 seconds before calling the &#8220;fadeScreen&#8221; method.  Let&#8217;s implement the fadescreen method.  I must note that I took the fadescreen method from <a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/12998-how-fade-between-views-transitioning-through-black.html" onclick="pageTracker._trackPageview('/outgoing/www.iphonedevsdk.com/forum/iphone-sdk-development/12998-how-fade-between-views-transitioning-through-black.html?referer=');">this post</a>.</div>
<div style="text-align: left; ">Add the following code:</div>
<div style="text-align: center;"><a href="http://icodeblog.com/wp-content/uploads/2009/03/screenshot_08.png"><img class="alignnone size-full wp-image-712" title="screenshot_08" src="http://icodeblog.com/wp-content/uploads/2009/03/screenshot_08.png" alt="screenshot_08" width="578" height="317" /></a></div>
<div style="text-align: left;">Lots of animation stuff.  Pretty well commented so I wont go into it too much.  Basically, we fade the view out in fadeScreen, then it calls finishedFading when its done.  Finished fading fades the view back in as well as fades viewController&#8217;s view back in.  It will now display our main view.  Make sure you remove the splash from the superview or you will get a weird transition.</div>
<div style="text-align: left;">That&#8217;s it for the splash page.  You can Build and Go to see the view transition from a splash to the main game.</div>
<p>That&#8217;s all for today.  Join me next time when I will show you how to add audio to your game. If you have any questions or comments, feel free to leave them in the comments section or <a href="http://twitter.com/brandontreb" onclick="pageTracker._trackPageview('/outgoing/twitter.com/brandontreb?referer=');">write me on Twitter</a>.</p>
<p>You can download the source for this tutorial <a href="http://icodeblog.com/wp-content/uploads/2009/03/itennis-3.zip">here</a></p>
<p>Happy iCoding!</p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/OYvchr7MS6g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/03/18/iphone-game-programming-tutorial-part-3-splash-screen/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/03/18/iphone-game-programming-tutorial-part-3-splash-screen/</feedburner:origLink></item>
		<item>
		<title>iPhone Programming Tutorial - Using openURL To Send Email From Your App</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/UsCf80SpP2A/</link>
		<comments>http://icodeblog.com/2009/02/20/iphone-programming-tutorial-using-openurl-to-send-email-from-your-app/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 18:59:07 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[iPhone Programming Tutorials]]></category>

		<category><![CDATA[iphone programming]]></category>

		<category><![CDATA[iphone send mail]]></category>

		<category><![CDATA[openURL]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=669</guid>
		<description><![CDATA[Have you been curious about how to open Mail.app from your applications to send contact email? Today, I will be teaching you how to do just that.  We will even be pre-filling the subject, to line, and body of the email.
This is a great way to to put a contact or bug report button on [...]]]></description>
			<content:encoded><![CDATA[<p>Have you been curious about how to open Mail.app from your applications to send contact email? Today, I will be teaching you how to do just that.  We will even be pre-filling the subject, to line, and body of the email.</p>
<p>This is a great way to to put a contact or bug report button on your app.  I&#8217;m going to start with a simple UI that I created.  I&#8217;m not going to discuss how it was created (I&#8217;ll leave that part up to you) as I have gone over Interface Builder quite a few times before.  </p>
<p>The UI simply consists of 2 UITextFields, a UITextArea, and a UIButton.  They are all connected to some code inside of the Applications Delegate.  This is not important, as the focus of this tutorial is to create a reusable function to send mail from your iPhone app. Here is a quick screenshot of the application&#8230;</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/02/screenshot_03.jpg"><img class="alignnone size-medium wp-image-670" title="screenshot_03" src="http://icodeblog.com/wp-content/uploads/2009/02/screenshot_03-156x300.jpg" alt="screenshot_03" width="156" height="300" /></a></p>
<p style="text-align: left; ">You can download my source code below, or simply start with a basic view-based application and make your own UI.  So, here is a function that I wrote to send email.  You can use this function in any application you wish.</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/02/screenshot_04.jpg"><img class="alignnone size-full wp-image-671" title="screenshot_04" src="http://icodeblog.com/wp-content/uploads/2009/02/screenshot_04.jpg" alt="screenshot_04" width="623" height="122" /></a></p>
<p style="text-align: left; ">Ok, so let me explain what is going on&#8230; First, the function takes 3 arguments.  These are pretty obvious based on their name.  Next, we are building a string.  This string will have the format of a URL.  It&#8217;s pretty much the same thing as doing a &#8220;mailto&#8221; link on a webpage. One thing I want to point out is the fact that I had to use <strong>stringByAddingPercentEscapesUsingEncoding </strong>.  Wow, that&#8217;s a mouthful.  You would think Apple could come up with a shorter name.  Maybe SanitizeURLString or something&#8230; Either way, this does all of the special character replacements in the URL.  So spaces get replaced with %20, etc&#8230;</p>
<p style="text-align: left; ">The next thing we do is simply open a URL using the built in openURL method in UIApplication.  This will cause the iPhone to open up Mail.app and magically, our to, subject, and body are already filled out.  Here is how I called the function in my app.</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/02/screenshot_05.jpg"><img class="alignnone size-full wp-image-672" title="screenshot_05" src="http://icodeblog.com/wp-content/uploads/2009/02/screenshot_05.jpg" alt="screenshot_05" width="551" height="50" /></a></p>
<p style="text-align: left; ">I just connected this IBAction to the Mail UIButton in my app.  So when this method fires, it gets the value of to, subject, and body and passes it to our sendEmailTo method.  Pretty sweet ehh?  </p>
<p style="text-align: left; ">That concludes this tutorial.  If you have any questions or comments feel free to leave them in the comments section or <a href="http://twitter.com/brandontreb" onclick="pageTracker._trackPageview('/outgoing/twitter.com/brandontreb?referer=');">ask me on Twitter</a>.  You can also download the source <a href="http://icodeblog.com/wp-content/uploads/2009/02/openmail.zip">here.</a></p>
<p>Happy iCoding!</p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/UsCf80SpP2A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/02/20/iphone-programming-tutorial-using-openurl-to-send-email-from-your-app/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/02/20/iphone-programming-tutorial-using-openurl-to-send-email-from-your-app/</feedburner:origLink></item>
		<item>
		<title>iPhone Game Programming Tutorial Part 2- User Interaction, Simple AI, Game Logic</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/mr0ZSca3YUA/</link>
		<comments>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 22:35:25 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[iPhone Game Programming]]></category>

		<category><![CDATA[iPhone Programming Tutorials]]></category>

		<category><![CDATA[game]]></category>

		<category><![CDATA[iphone game tutorial]]></category>

		<category><![CDATA[itennis]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=656</guid>
		<description><![CDATA[Ok folks, here it is. The next tutorial in our iPhone game programming tutorial (sorry for the delay).  Today, I will be discussing the basics of player interaction, simple game AI, and game logic.  We will also be exploring how to do simple collision detection so we know when the ball hits a paddle. Per [...]]]></description>
			<content:encoded><![CDATA[<p>Ok folks, here it is. The next tutorial in our iPhone game programming tutorial (sorry for the delay).  Today, I will be discussing the basics of player interaction, simple game AI, and game logic.  We will also be exploring how to do simple collision detection so we know when the ball hits a paddle. Per popular request, I will be adding &#8220;Challenges&#8221; to the bottom of the tutorials from now on to give some more advanced ideas for improvement. Let&#8217;s begin. Start by opening your code from part 1&#8230;</p>
<h3>User Interaction</h3>
<p>The first thing we will implement is user interaction.  All we really want to do is move the paddle&#8217;s X location to the X location of the touch from the user.  This will be a very simple implementation and could be much better (I will add this as a challenge at the bottom of the tutorial).  Open <strong>iTennisViewController.m </strong>and add the following code.</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/02/screenshot_01.jpg"><img class="alignnone size-full wp-image-657" title="screenshot_01" src="http://icodeblog.com/wp-content/uploads/2009/02/screenshot_01.jpg" alt="screenshot_01" width="442" height="218" /></a></p>
<p style="text-align: left; ">Just as we did in a previous tutorial, we are overriding the <strong>touchesMoved</strong> method.  This will detect when the user &#8220;drags&#8221; their finger on the screen.  First, I added the &#8220;else if&#8221; statement inside of <strong>touchesBegan</strong> that simply forwards all events to <strong>touchesMoved</strong> if the game is in a running state.</p>
<p style="text-align: left; ">The first 2 lines inside of <strong>touchesMoved </strong>simply detect the location of the user&#8217;s touch.  Next, we need to create a new CGPoint from the X location of the touch and the Y location of the yellow racquet (player racquet).  Objective-C won&#8217;t simply let us say racquet_yellow.center.x = location.x.  This is probably because CGPoint is immutable (not editable).</p>
<p style="text-align: left; ">Finally, the center of the player&#8217;s racquet is set to our new location.</p>
<h3>Collision Detection</h3>
<p>*Update, the user Naren has pointed out a much simpler collision detection.  The code has been updated to reflect it. Inside the gameLoop method of iTennisViewController.m add the following code</p>
<p style="text-align: center; "><span style="color: #0000ee; text-decoration: underline;"><a href="http://icodeblog.com/wp-content/uploads/2009/02/picture-1.png"></a><a href="http://icodeblog.com/wp-content/uploads/2009/02/screenshot_011.jpg"><img class="alignnone size-full wp-image-677" title="screenshot_011" src="http://icodeblog.com/wp-content/uploads/2009/02/screenshot_011.jpg" alt="screenshot_011" width="370" height="175" /></a></span></p>
<p style="text-align: left; ">So, Apple has provided us with a very handy methods to check if to object frames collide.  Its called <strong>CGRectIntersectsRect.</strong>  We simply hand this method the frame of our ball and racquet.  When the ball collides with the racquet, we want to reverse its Y velocity.  The next if statement is required because sometimes we get in a state where the ball gets &#8220;trapped&#8221; on a paddle bouncing back and for and not going anywhere.  So, we want to ensure the ball&#8217;s velocity only gets reversed if it is front of each racquet. (Note, the NSlog is not needed, it was just for debugging)</p>
<h3>Simple Game AI</h3>
<p style="text-align: left; ">Next, we are going to discuss how simple AI can be added to allow a computer player to play iTennis with you.  Many of you might not know just how much is involved in a decent Artificial intelligence.  I could go on and on with nerdy math, philosophy, heuristics and the like, but I&#8217;m not.  I will show you some super NOOB, very easy to understand game AI.  Basically, the computer will &#8220;watch&#8221; the ball and move in the direction of it in hopes of hitting it.  Let&#8217;s get started&#8230; </p>
<p style="text-align: left; ">We first need to define a constant that will define how fast the computer player can move.  Add the following define to the top of iTennisViewController.m</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/02/picture-2.png"><img class="alignnone size-full wp-image-660" title="picture-2" src="http://icodeblog.com/wp-content/uploads/2009/02/picture-2.png" alt="picture-2" width="156" height="20" /></a></p>
<p style="text-align: left; ">As you start testing, you can adjust this number.  This is basically defining how fast the computer player can move in order to get to the ball.  The higher you make this number, the &#8220;better&#8221; the computer player will be.  You could actually make your computer unbeatable if this number were high enough.  Now, add the following code right under your collision detection code:</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/02/picture-3.png"><img class="alignnone size-full wp-image-661" title="picture-3" src="http://icodeblog.com/wp-content/uploads/2009/02/picture-3.png" alt="picture-3" width="663" height="174" /></a></p>
<p style="text-align: left; ">The first &#8220;if&#8221; statement is to add some difficulty for the computer.  It basically checks to see if the ball is on &#8220;his&#8221; side of the court.  The computer will not move or respond to the ball unless it&#8217;s on his side.  It could be omitted, but makes for a more interesting game.  The next if statements check to see if the X coordinates of the center of the ball are different than the X coordinates of the center of the racquet.  If the ball is to the right of the computer&#8217;s racquet, the X coordinate of the computer&#8217;s racquet is increased by <strong>kCompMoveSpeed</strong>. If the ball is to the left of the computer&#8217;s racquet, the X coordinate of the computer&#8217;s racquet is decreased by <strong>kCompMoveSpeed. </strong></p>
<p style="text-align: left; ">It should now be clear how adjusting the kCompMoveSpeed variable, will affect the computer&#8217;s performance&#8230;</p>
<p style="text-align: left; ">Now, you can actually hit Build and Go to see the game in action.  As you can see the computer responds to the ball and hits it most of the time.  There is still one last piece to make the game fun. Scoring!</p>
<h3>Game Mechanics: Scoring</h3>
<p style="text-align: left; ">Now, we need a way to keep score.  This is actually some more simple collision detection.  We are basically checking to see if the ball collides with the back walls.  First, let&#8217;s define a few variables and a method.  Open up iTennisViewController.h.  Add the following highlighted code:</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/02/picture-4.png"><img class="alignnone size-full wp-image-662" title="picture-4" src="http://icodeblog.com/wp-content/uploads/2009/02/picture-4.png" alt="picture-4" width="398" height="450" /></a></p>
<p style="text-align: left; ">We need integer representations of the score so we can add points when the player and the computer score.  Also, we will need a function called reset that will be called to reset the ball to the center of the screen.  Now we need to define one more variable.  Add the following line to your defines at the top of iTennisViewController.m</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/02/picture-5.png"><img class="alignnone size-full wp-image-663" title="picture-5" src="http://icodeblog.com/wp-content/uploads/2009/02/picture-5.png" alt="picture-5" width="132" height="18" /></a></p>
<p style="text-align: left; ">This variable is pretty self explanatory, but in case you didn&#8217;t catch on, it defines the amount of points needed to win.  I just made it 5 for a quick game.  Now, let&#8217;s check to see if a player or computer scored.  Right after your AI code, add the following code:</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/02/picture-6.png"><img class="alignnone size-full wp-image-664" title="picture-6" src="http://icodeblog.com/wp-content/uploads/2009/02/picture-6.png" alt="picture-6" width="346" height="150" /></a></p>
<p style="text-align: left; ">Ok, first we see 2 if statements.  The are basically checking to see if the ball has hit/passed the top or bottom of the screen.  If it passes the top, the player score gets incremented.  If it passes the bottom, the computer score gets incremented.  The next line contains a little bit of fanciness if you are new to programming.  We are calling the reset function, but what is that expression we are passing to it? </p>
<p style="text-align: left; ">Well, if you look at the definition of reset, it takes a BOOL value that determines if the game is over.  So this can either be true or false.  We are simply passing true or false when the expression is evaluated.  So, (player_score_value &gt;= kScoreToWin) will evaluate to false when the player_score_value variable is less than 5.  Once this variable reaches 5, it will return true and pass it into the reset function.</p>
<p style="text-align: left; ">Why do this? Well it saves us lines of code and complexity.  So now you don&#8217;t have to do if(player_score_value &gt;= kScoreToWin) ) [self reset:YES]; }else{[self reset:NO];} . make sense?</p>
<p style="text-align: left; ">Now, let&#8217;s define the reset function. Add the following method to iTennisViewController.m</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/02/picture-7.png"><img class="alignnone size-full wp-image-665" title="picture-7" src="http://icodeblog.com/wp-content/uploads/2009/02/picture-7.png" alt="picture-7" width="496" height="272" /></a></p>
<p style="text-align: left; ">The first thing we do is pause the game.  Remember pausing the game causes the &#8220;Tap to Begin&#8221; Message to Display. Next, we center the ball on the screen.  If YES/true was passed in for the newGame variable, we need to do a few things.  First, we check who won by comparing the computer and player scores.  Next, we update the &#8220;tapToBegin&#8221; message to notify the player who won.  You could add another label for this, but I am just recycling this one&#8230; Finally, we reset the player and computer scores to 0 because a new game is starting.</p>
<p style="text-align: left; ">If it is not a new game, we need to reset the tapToBegin message to display &#8220;tapToBegin&#8221;.  This has to be done in case the message was altered to say &#8220;Player/Computer wins!&#8221;. Finally, we update the labels on the screen to reflect the new scores.  Now you should be good to go&#8230;</p>
<p style="text-align: left; ">Click Build and Go and battle the computer in an epic game of iTennis!  If you have any comments or questions, leave them here or <a href="http://twitter.com/brandontreb" onclick="pageTracker._trackPageview('/outgoing/twitter.com/brandontreb?referer=');">ask me on Twitter</a>.  You can also download the source for this tutorial <a href="http://icodeblog.com/wp-content/uploads/2009/02/itennis-2.zip"></a><a href="http://icodeblog.com/wp-content/uploads/2009/02/itennis-21.zip">here</a></p>
<h3>As Promised, Here are some challenges</h3>
<p> </p>
<ul>
<li>Improve on user interaction - Make it so when the user taps, the racquet moves towards the tap rather than moves directly to the tap location</li>
<li>Improve collision detection - When the ball hits the paddle, use some simple physics to make the speed of the paddle affect the speed (and direction) of the ball</li>
<li>Improve on the AI - add some randomness to your AI, make it attempt to &#8220;predict&#8221; where the ball is going to be</li>
<li>Improve Scoring - Make it used tennis scores 15, 30 , etc&#8230;</li>
<li>Improve scoring - Make it so you must win by 2 points</li>
</ul>
<p> </p>
<p style="text-align: left; ">Stay tuned for the next tutorial when I will be going over game audio, splash screen, about, and some other polishing&#8230; Happy iCoding!</p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/mr0ZSca3YUA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/</feedburner:origLink></item>
		<item>
		<title>Loading data from .plist files</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/LmgIy9QrX9c/</link>
		<comments>http://icodeblog.com/2009/02/14/loading-data-from-plist-files/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 14:16:15 +0000</pubDate>
		<dc:creator>josh</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=605</guid>
		<description><![CDATA[Saving and Reloading from .plist files&#8230;
A great way to store dictionary data that does not change during runtime is in a .plist file.  Say you want to organize some data hierarchically or you want to store the navigation structure of a drill-down somewhere more convenient (see drill-down save example in apple docs), then a [...]]]></description>
			<content:encoded><![CDATA[<h3>Saving and Reloading from .plist files&#8230;</h3>
<p>A great way to store dictionary data that does not change during runtime is in a .plist file.  Say you want to organize some data hierarchically or you want to store the navigation structure of a drill-down somewhere more convenient (see drill-down save example in apple docs), then a .plist file is a great way to go.</p>
<p>Here&#8217;s a quick example of how to restore data from a plist file.  I&#8217;ll use a plist file that you can find in every app out there:  Info.plist</p>
<p>Sometimes it&#8217;s useful to display a version number on a splash view and here&#8217;s how you can do that using the Info.plist CFBundleVersion value.</p>
<p><code><br />
NSString *path = [[NSBundle mainBundle] bundlePath];<br />
NSString *finalPath = [path stringByAppendingPathComponent:@"Info.plist"];<br />
NSDictionary *plistData = [[NSDictionary dictionaryWithContentsOfFile:finalPath] retain];</p>
<p>versionLabel = [[UILabel alloc] initWithFrame:CGRectMake(100,100,60,25)];  // for example<br />
versionLabel.backgroundColor = [UIColor clearColor];<br />
versionLabel.textColor = [UIColor whiteColor];<br />
versionLabel.font = [UIFont	systemFontOfSize:10];<br />
NSString *versionString = [NSString stringWithFormat:@"v%@", [plistData objectForKey:@"CFBundleVersion"]];<br />
versionLabel.text = versionString;<br />
[self.view addSubview:versionLabel];<br />
</code></p>
<p>
Now you can see pretty easily how the plist file becomes an NSDictionary object.  Pretty easy no?</p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/LmgIy9QrX9c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/02/14/loading-data-from-plist-files/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/02/14/loading-data-from-plist-files/</feedburner:origLink></item>
		<item>
		<title>Great Resource For All iPhone Developers - iBetaTest.com</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/xyZhqDpnonA/</link>
		<comments>http://icodeblog.com/2009/02/02/great-resource-for-all-iphone-developers-ibetatestcom/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 06:19:07 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[iPhone Articles]]></category>

		<category><![CDATA[iphone beta test]]></category>

		<category><![CDATA[iPhone Coding]]></category>

		<category><![CDATA[iphone developer]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=616</guid>
		<description><![CDATA[
Through my travels of the internets, I have encountered a great website for iPhone developers looking to have their applications beta tested by real people.  The website is called iBetaTest.com . 
Launching their site just yesterday, iBetaTest.com already boasts 135 registered testers and 44 registered developers!  Here is the skinny on how it works (per their website).

Beta [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center; "><a href="http://ibetatest.com/iphone/controllers/register/" onclick="pageTracker._trackPageview('/outgoing/ibetatest.com/iphone/controllers/register/?referer=');"><img class="size-full wp-image-617 aligncenter" title="ss" src="http://icodeblog.com/wp-content/uploads/2009/02/ss.jpg" alt="ss" width="503" height="300" /></a></p>
<p style="text-align: left; ">Through my travels of the internets, I have encountered a great website for iPhone developers looking to have their applications beta tested by real people.  The website is called <a href="http://ibetatest.com" onclick="pageTracker._trackPageview('/outgoing/ibetatest.com?referer=');">iBetaTest.com</a> . </p>
<p style="text-align: left; ">Launching their site just yesterday, <a href="http://ibetatest.com/iphone/controllers/register/" onclick="pageTracker._trackPageview('/outgoing/ibetatest.com/iphone/controllers/register/?referer=');">iBetaTest.co</a>m already boasts 135 registered testers and 44 registered developers!  Here is the skinny on how it works (per their website).</p>
<ul>
<li>Beta testers and developers <a href="http://ibetatest.com/iphone/controllers/register/" onclick="pageTracker._trackPageview('/outgoing/ibetatest.com/iphone/controllers/register/?referer=');">register</a> for a free account</li>
<li>Beta testers <a href="http://ibetatest.com/iphone/controllers/login/" onclick="pageTracker._trackPageview('/outgoing/ibetatest.com/iphone/controllers/login/?referer=');">log in</a> and go into the Device Manager and add all of their devices</li>
<li>Developers can go to Manage Betas module and create a new beta<br />
- at this point they specify beta type (public, manual, invite only, the auto approve setting, etc.)<br />
- select which devices are required to run their application (iPhone, iPhone 3G, iPod touch v1, v2, or All)<br />
- set number of desired testers (2-100)<br />
- write the application’s description<br />
- provide info on any incentives for beta tester participation<br />
- upload the application files, license file and any screenshots they want<br />
- write what needs to be tested and add any special instructions and <em>voila</em> - the app is up and running</li>
<li>At this point (if app is set public), beta testers can see it and apply for it<br />
- ONLY beta testers with devices the application supports, and with UDID’s already entered can apply for a given beta<br />
- If the application is set to auto approve - they are automatically added to the list of testers, until the limit set by the developer is reached<br />
- If it is not set to auto approve - the developer gets an email, and then either approves or denies the tester </li>
<li>During this time, no matter if the application is public or private, developer can also send invites to anyone to come and join the beta<br />
- Users not yet registered on iBetaTest.com get an email, and once they sign up, their Pending Beta Testing Invitation will be shown on the Dashboard from where they can accept or deny it<br />
- Registered members also see it on the Dashboard, and can approve or reject any invitation straight from there<br />
- NO INVITE CODES are necessary. It’s all seamless and based on user’s email address, for both registered and non registered members <img class="wpSmiley" src="http://ibetatest.com/blog/wp-content/plugins/wp-smiley-switcher/yellowpack/icon_smile.gif" alt="" /> </li>
<li>There is a convenient “Get ADC Import File” feature for developers, which lets them download a file containing beta tester’s names and UDID’s which is directly importable into Apple’s Developer’s Connection portal; no more copying and pasting <img class="wpSmiley" src="http://ibetatest.com/blog/wp-content/plugins/wp-smiley-switcher/yellowpack/icon_smile.gif" alt="" /></li>
<li>At any time developer can simply click Close For Signups button under My Betas module and close the beta signup process (which is not necessary)</li>
<li>Approved beta testers can access all features the system offers right on every application’s home page<br />
- From there they may send reports (bugs, feature requests, comments) and communicate with developer and other testers<br />
- Everyone can also download Application files, documentation, and license files straight from there</li>
<li>The system AUTOMATICALLY checks developer’s<em>.mobileprovision</em> files to see if the tester’s UDID has been provisioned in that version, and notifies a tester if he/she should be downloading any files yet.<br />
- This way, developers do not have to send the files individually to each tester. They are all available in the same pool, and as soon as the license is uploaded, beta testers know if their device can run and install it yet or not.</li>
<li>During the beta testing - developers can also email users from My Betas module at any time (one by one, or all at once) with any info they have that has to get to testers right away. If a support email address is provided in developer’s profile, these emails are shown as if they are coming from that address, however, if none is entered, they are all sent from system@ibetatest.com</li>
<li>Privacy is STRONGLY guarded on iBetaTest.com. From initial interviews with developers, before the system was even built, all they cared about was what the beta testers have to say - not, what their personal information is<br />
- The only piece of information a developer can see on their tester is the First Name (for a more professional communication), and tester’s username.<br />
- The system itself sends all information via integrated mailing system, thus enforcing the use of Reports Module for all direct communication with the developer<br />
- Each report can be set to either “for all” or “for developer only”, making it easy to talk to the developer “in private”</li>
<li>Both developers and beta testers can set their personal profiles (with addition of developers also having a developer profile), where they can publish all other info they’d like to share with the world: Short bio, and links to their Linked-In, Facebook and Twitter profiles</li>
<li>Once the beta testing has finished, the developer has a chance to rate the beta testers (1-5 star rating) and write a short note, which will become a part of Tester’s Testimonials Page (located right on their profile with all other info)</li>
<li>Rating system is an interesting one, to say the least. Each star is 10 points. THERE WILL BE REWARDS for first testers to reach 200, 500, 1000, and so on points - and these won’t be shabby either! Stay tuned for more info on this.</li>
</ul>
<p> </p>
<p style="text-align: left; ">After registering for a developer account, it was clear to me that this site is rock solid.  From the looks of it, they have coded it in <a href="http://rubyonrails.org/" onclick="pageTracker._trackPageview('/outgoing/rubyonrails.org/?referer=');">Ruby on Rails</a> (great choice) which is obvious by their clean URL structure and smooth ajax effects.  At the moment, the site doesn&#8217;t currently have any active beta applications, but I am sure this will change in the near future.  I will be following this site closely (and maybe even submitting some betas for testing).  They also have a twitter which can be found here: <a href="http://twitter.com/ibetatest" onclick="pageTracker._trackPageview('/outgoing/twitter.com/ibetatest?referer=');">http://twitter.com/ibetatest</a> if your a Twitter kind of person (you should be).</p>
<p style="text-align: left; ">So, be sure and let me know what you think of this site and share your experience in the comments or <a href="http://twitter.com/brandontreb" onclick="pageTracker._trackPageview('/outgoing/twitter.com/brandontreb?referer=');">write me on twitter.</a> I can&#8217;t wait to launch the next tutorial in the game series (it will blow your socks off)&#8230; Unit then, happy iCoding!</p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/xyZhqDpnonA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/02/02/great-resource-for-all-iphone-developers-ibetatestcom/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/02/02/great-resource-for-all-iphone-developers-ibetatestcom/</feedburner:origLink></item>
		<item>
		<title>Follow Us on Twitter!</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/Yu4UjEZzsBo/</link>
		<comments>http://icodeblog.com/2009/01/30/follow-me-on-twitter/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 00:58:08 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[iphone]]></category>

		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=612</guid>
		<description><![CDATA[http://twitter.com/rightsprite
Stay tuned for the next game programming tutorial.  Should be up soon&#8230;
Happy iCoding.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://twitter.com/rightsprite" onclick="pageTracker._trackPageview('/outgoing/twitter.com/rightsprite?referer=');">http://twitter.com/rightsprite</a></p>
<p>Stay tuned for the next game programming tutorial.  Should be up soon&#8230;</p>
<p>Happy iCoding.</p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/Yu4UjEZzsBo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/01/30/follow-me-on-twitter/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/01/30/follow-me-on-twitter/</feedburner:origLink></item>
		<item>
		<title>iPhone Game Programming Tutorial - Part 1</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/n8lPnc_1ELo/</link>
		<comments>http://icodeblog.com/2009/01/15/iphone-game-programming-tutorial-part-1/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 22:19:53 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[iPhone Game Programming]]></category>

		<category><![CDATA[iPhone Programming Tutorials]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=572</guid>
		<description><![CDATA[This is the first in a multipart series where I will be teaching you to create an iPhone game from the ground up.  As many of you know, OpenGL and Quartz have quite a steep learning curve.  This tutorial will simplify the development process and not use either one of those technologies.  For our graphics, [...]]]></description>
			<content:encoded><![CDATA[<p>This is the first in a multipart series where I will be teaching you to create an iPhone game from the ground up.  As many of you know, OpenGL and Quartz have quite a steep learning curve.  This tutorial will simplify the development process and not use either one of those technologies.  For our graphics, we will simply use UIImageViews.  </p>
<p>In this tutorial series, I will teach you about every aspect of developing an iPhone game.  The game will include graphics, sounds, game mechanics, and even some simple computer AI. </p>
<p>The game we will be creating is called iTennis.  It is essentially Pong with a tennis theme.  It will follow all of the same rules and mechanics of Pong.  I chose this as a first game tutorial as iTennis does not require any special animation.  If there is significant interest, I will move on to a more complex game in a later series. Here is a screenshot of the game we will be making:</p>
<p> </p>
<p style="text-align: center;"><a href="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_011.jpg"><img class="alignnone size-full wp-image-609" title="screenshot_011" src="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_011.jpg" alt="screenshot_011" width="386" height="742" /></a></p>
<p>Let&#8217;s get started&#8230; Here are the images you will need for the project. (I know my Photoshop skillz are weak, so be easy on me).  Click the link below to download the zipped images.<br />
   </p>
<p> </p>
<dt class="wp-caption-dt" style="text-align: center;"><a href="http://icodeblog.com/wp-content/uploads/2009/01/itennis_images.zip"><img class="size-full wp-image-580" title="iTennis_Images.zip" src="http://icodeblog.com/wp-content/uploads/2009/01/packageicon.png" alt="iTennis_Images.zip" width="123" height="113" /></a></dt>
<p> </p>
<p>Open up XCode and create a View Based Application. Name this application iTennis.</p>
<p> </p>
<div style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_01.jpg"><img class="alignnone size-full wp-image-583" title="screenshot_01" src="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_01.jpg" alt="screenshot_01" width="600" height="442" /></a></div>
<div style="text-align: left; ">After you unzip all of the images, drag them into the project Resources folder.  After you have done this, the resources folder should look like this.</div>
<div style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_02.jpg"><img class="alignnone size-full wp-image-584" title="screenshot_02" src="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_02.jpg" alt="screenshot_02" width="240" height="306" /></a></div>
<div style="text-align: left; ">Now we are ready to start coding.  We need to first establish our IBOutlet connections so that we can interact with our images in code.  We will also add some of the game variables that we will be using in this tutorial.  Open up <strong>iTennisViewController.h </strong>and add the following code:</div>
<div style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_05.jpg"><img class="alignnone size-full wp-image-585" title="screenshot_05" src="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_05.jpg" alt="screenshot_05" width="397" height="405" /></a></div>
<div style="text-align: left; ">As you can see, we have quite a few IBOutlets.  This is because there are many objects we need to interact with.  For now, ignore the ballVelocity and gameState variables.  Now, we are ready to build our interface.  Double click on the file <strong>iTennishViewController.xib </strong>to open it up inside of Interface Builder.  Here is a video of me setting up the interface.</div>
<div style="text-align: left; ">
<p>
<script type="text/javascript">
<!--
var ourTags='';
ourTags+='<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="640" HEIGHT="416" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">';
ourTags+='<PARAM name="SRC" VALUE="http://icodeblog.com/wp-content/uploads/2009/01/Game_1.mov" />';
ourTags+='<PARAM name="CONTROLLER" VALUE="true" />';
ourTags+='<PARAM name="AUTOPLAY" VALUE="false" />';
ourTags+='<PARAM name="SCALE" VALUE="ASPECT" />';
ourTags+='<EMBED ';
ourTags+='SRC="http://icodeblog.com/wp-content/uploads/2009/01/Game_1.mov" CONTROLLER="true"';
ourTags+=' type="video/quicktime" WIDTH="640" HEIGHT="416" AUTOPLAY="false" SCALE="ASPECT" PLUGINSPAGE="http://www.apple.com/quicktime/download/"></EMBED>';
ourTags+='</OBJECT>';
if (typeof writeTags == "undefined") { document.write(ourTags);} else {writeTags(ourTags);
}//-->
</script>
<noscript>
<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="640" HEIGHT="416" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">
<PARAM name="SRC" VALUE="http://icodeblog.com/wp-content/uploads/2009/01/Game_1.mov" />
<PARAM name="CONTROLLER" VALUE="true" />
<PARAM name="AUTOPLAY" VALUE="false" />
<PARAM name="SCALE" VALUE="ASPECT" />
<EMBED 
SRC="http://icodeblog.com/wp-content/uploads/2009/01/Game_1.mov" CONTROLLER="true"
 type="video/quicktime" WIDTH="640" HEIGHT="416" AUTOPLAY="false" SCALE="ASPECT" PLUGINSPAGE="http://www.apple.com/quicktime/download/"></EMBED>
</OBJECT>

</noscript>
</p></div>
<div style="text-align: left; ">Now that you have made the connections, close Interface Builder and return to XCode.  We need to set up some constants.  You can hardcode these values in somewhere, but making them constants makes them easier to change when you are tweaking the mechanics of your game. Open up <strong>iTennisViewController.m</strong> and add the following code.</div>
<div style="text-align: center; "><strong><a href="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_06.jpg"><img class="alignnone size-full wp-image-586" title="screenshot_06" src="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_06.jpg" alt="screenshot_06" width="656" height="153" /></a></strong></div>
<div style="text-align: left; ">Let me explain the purpose of the constants.  The first 2 are game states.  We use these to determine what is to be shown on screen.  Is the game paused, is it running, is it at the title screen?  We will add more states later on in the game.  The next 2 variables are speeds for the ball to travel.  Since the game is 2D, the ball can have an X and Y speed to make up its velocity vector.  The next line synthesizes the variables we will use to create their getter and setter methods automatically.</div>
<div style="text-align: left; ">Now let&#8217;s write the viewDidLoad method. Add the following code:</div>
<div style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_07.jpg"><img class="alignnone size-full wp-image-587" title="screenshot_07" src="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_07.jpg" alt="screenshot_07" width="701" height="115" /></a></div>
<div style="text-align: left; ">First, we are setting our game state to a paused game state.  This is so the game doesn&#8217;t start right away when the view loads.  Next, we create a vector for the ball&#8217;s velocity.  Adjust the constants that we defined earlier for a faster or slower ball speed.  Finally, we create an NSTimer instance.  The first parameter is the timestep.  We have set the time step to 0.05 seconds.  Adjusting this will change the speed of the entire game. Next we set the target.  This is telling the timer where the callback is located.  The callback is the next parameter.  Basically, we are telling the timer to call self.gameLoop every 0.05 seconds.  We don&#8217;t need to worry about the userInfo param.  The last parameter just tells the timer to repeat.</div>
<div style="text-align: left; ">Now that we have initialized our game, let&#8217;s create the game loop.  Add the following method:</div>
<div style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_08.jpg"><img class="alignnone size-full wp-image-588" title="screenshot_08" src="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_08.jpg" alt="screenshot_08" width="609" height="263" /></a></div>
<div style="text-align: left; ">First, we are checking to see if the game is in a running state (we don&#8217;t want to move the ball in a paused state).  If the game is not running, we will show the tapToBegin label.  This is just the label defined earlier that tells the user to tap the screen to begin.</div>
<div style="text-align: left; ">If the game is running, we start by moving the ball according to its velocity vector.  The next few lines do some bounds checking.  If the ball hits the side of the screen, we want to reverse its velocity so that it &#8220;bounces&#8221;.  Without this code, the ball would fly off the screen.</div>
<div style="text-align: left; ">The last bit of code we will need to write is the touchesBegan method.  We will use this method to start the game when the game is in a paused state.  Add the following code:</div>
<div style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_09.jpg"><img class="alignnone size-full wp-image-589" title="screenshot_09" src="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_09.jpg" alt="screenshot_09" width="409" height="91" /></a></div>
<div style="text-align: left; ">What this does is first checks to see if we are in a paused state.  If so, we hide the tapToBegin label and set the game in a running state.  This will get the game running.  Eventually, we will write the code to control the player paddle in this function.</div>
<div style="text-align: left; ">Finally, being good iPhone developers, we need to clean up the resources that we allocated.  Add the following code to the dealloc method.</div>
<div style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_10.jpg"><img class="alignnone size-full wp-image-590" title="screenshot_10" src="http://icodeblog.com/wp-content/uploads/2009/01/screenshot_10.jpg" alt="screenshot_10" width="184" height="135" /></a></div>
<div style="text-align: left; ">That concludes part 1 of our game development tutorial series.  If you have any questions or comments, feel free to leave them in the comments section of this post.  You can download the source code <a href="http://icodeblog.com/wp-content/uploads/2009/01/itennis.zip">here</a>. Happy iCoding!</div>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/n8lPnc_1ELo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/01/15/iphone-game-programming-tutorial-part-1/feed/</wfw:commentRss>
<enclosure url="http://icodeblog.com/wp-content/uploads/2009/01/Game_1.mov" length="14481335" type="video/quick" />
		<feedburner:origLink>http://icodeblog.com/2009/01/15/iphone-game-programming-tutorial-part-1/</feedburner:origLink></item>
		<item>
		<title>New Job… New People… More iPhone Coding Goodness</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/Obb0mUEf4EI/</link>
		<comments>http://icodeblog.com/2009/01/15/new-job-new-people-more-iphone-coding-goodness/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 19:42:16 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=594</guid>
		<description><![CDATA[So, I have recently accepted a job with a company called RightSprite.  This job is a great opportunity for me as I will be writing iPhone applications for a living! Pretty sick eh? 
What does this mean for iCodeBlog.com?  Glad you asked.  It means better tutorials.  As I will be coding Objective C every day of [...]]]></description>
			<content:encoded><![CDATA[<p>So, I have recently accepted a job with a company called <a href="http://rightsprite.com" onclick="pageTracker._trackPageview('/outgoing/rightsprite.com?referer=');">RightSprite</a>.  This job is a great opportunity for me as I will be writing iPhone applications for a living! Pretty sick eh? </p>
<p>What does this mean for iCodeBlog.com?  Glad you asked.  It means better tutorials.  As I will be coding Objective C every day of my life, my skill set will become greater and greater.  I will be able to write more in depth tutorials.  Also,  the team at Rightsprite is made up of many brilliant individuals.  So as time goes on, you will see them posting tutorials and other resources as well.</p>
<p>So better content and more frequent tutorials&#8230; what&#8217;s not to love.  </p>
<p>Also, I don&#8217;t mean to plug the company I work for too much, but I get a lot of requests for freelance work via email.  I can now fulfill those requests via Rightsprite.  So, if you have an iPhone application that you want developed, head on over to <a href="http://rightsprite.com" onclick="pageTracker._trackPageview('/outgoing/rightsprite.com?referer=');">rightsprite.com</a> and contact the HR people.  I will certainly be one of the developers working on your application.</p>
<p>So be on the look out for posts from the RightSprite team.  Also, the first part in my iPhone game programming tutorial series is just about to launch.  Check back really soon&#8230;</p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/Obb0mUEf4EI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2009/01/15/new-job-new-people-more-iphone-coding-goodness/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2009/01/15/new-job-new-people-more-iphone-coding-goodness/</feedburner:origLink></item>
		<item>
		<title>Animoto launch… and already Techcrunched!</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/fyFtAFQx8Nk/</link>
		<comments>http://icodeblog.com/2008/12/23/animoto-launch-and-already-techcrunched/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 12:53:00 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
		
		<category><![CDATA[Animoto]]></category>

		<category><![CDATA[Clients]]></category>

		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://icodeblog.com/2008/12/23/animoto-launch-and-already-techcrunched/</guid>
		<description><![CDATA[
Wow! The guys at Animoto are a client and a great team to work with. They have an excellent sense of style and cleanliness of usability. But don&#8217;t listen to us. We&#8217;re biased.  Check out what TechCrunch&#8217;s Michael Arrington had to say:

 Why this is so great - you no longer have to wait [...]]]></description>
			<content:encoded><![CDATA[<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_lxprOj2a6Ms/SVDjg0SHCvI/AAAAAAAAAE0/7FMZuuX1NW0/s1600-h/Picture+19.png" onclick="pageTracker._trackPageview('/outgoing/1.bp.blogspot.com/_lxprOj2a6Ms/SVDjg0SHCvI/AAAAAAAAAE0/7FMZuuX1NW0/s1600-h/Picture+19.png?referer=');"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 172px; height: 320px;" src="http://1.bp.blogspot.com/_lxprOj2a6Ms/SVDjg0SHCvI/AAAAAAAAAE0/7FMZuuX1NW0/s320/Picture+19.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5282972515835513586" /></a>
<div>Wow! <a href="http://animoto.com/" onclick="pageTracker._trackPageview('/outgoing/animoto.com/?referer=');">The guys at Animoto</a> are a client and a great team to work with. They have an excellent sense of style and cleanliness of usability. But don&#8217;t listen to us. We&#8217;re biased. <img src='http://icodeblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> Check out what <a href="http://www.techcrunch.com/2008/12/23/animoto-on-the-iphone-rocks/" onclick="pageTracker._trackPageview('/outgoing/www.techcrunch.com/2008/12/23/animoto-on-the-iphone-rocks/?referer=');">TechCrunch&#8217;s Michael Arrington</a> had to say:</div>
<div>
<blockquote> Why this is so great - you no longer have to wait until you get home and to your computer to create slide shows of the amazing pictures you take at a wedding, sports event, or whatever. Make it on the fly and then email it out to friends while you’re still there. I love it.</p></blockquote>
<p></div>
<div>Animoto Videos is free and <a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=300033126&amp;mt=8" onclick="pageTracker._trackPageview('/outgoing/itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=300033126_amp_mt=8&amp;referer=');">available on iTunes now!</a></div>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/fyFtAFQx8Nk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2008/12/23/animoto-launch-and-already-techcrunched/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2008/12/23/animoto-launch-and-already-techcrunched/</feedburner:origLink></item>
		<item>
		<title>iPhone Coding - Learning About UIWebViews by Creating a Web Browser</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/gDB988LnQnc/</link>
		<comments>http://icodeblog.com/2008/12/19/iphone-coding-learning-about-uiwebviews-by-creating-a-web-browser/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 21:54:30 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[Interface Builder]]></category>

		<category><![CDATA[iPhone Programming Tutorials]]></category>

		<category><![CDATA[iPhone Coding]]></category>

		<category><![CDATA[uiwebview]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=549</guid>
		<description><![CDATA[Wow! It has been a long time since my last tutorial&#8230; As I wrote in my last post, I had to take a break due to my wife having our baby.  But, now I&#8217;m back and have a great tutorial for you guys.  
Today I will be showing you how to work with a  UIWebview [...]]]></description>
			<content:encoded><![CDATA[<p>Wow! It has been a long time since my last tutorial&#8230; As I wrote in my last post, I had to take a break due to my wife having our baby.  But, now I&#8217;m back and have a great tutorial for you guys.  </p>
<p>Today I will be showing you how to work with a  UIWebview to create a basic web browser.  Here is a screenshot of the app we are going to create.</p>
<p style="text-align: center; "><img class="size-full wp-image-550 aligncenter" title="screenshot_02" src="http://icodeblog.com/wp-content/uploads/2008/12/screenshot_02.png" alt="screenshot_02" width="386" height="742" /></p>
<h2>Create a View-Based Application</h2>
<p style="text-align: left; ">Ok, so let&#8217;s get started.  Start by opening up Xcode and click <strong>File -&gt; New Project</strong>.  Next select <strong>View-Based Application</strong> and click <strong>Choose&#8230; </strong>Name this project something like <strong>iCodeBrowser</strong> and click <strong>Save</strong>.  </p>
<p style="text-align: center; "><img class="alignnone size-full wp-image-552" title="screenshot_03" src="http://icodeblog.com/wp-content/uploads/2008/12/screenshot_03.png" alt="screenshot_03" width="600" height="442" /></p>
<p style="text-align: center; "><img class="alignnone size-full wp-image-551" title="screenshot_04" src="http://icodeblog.com/wp-content/uploads/2008/12/screenshot_04.png" alt="screenshot_04" width="518" height="413" /></p>
<p style="text-align: left; ">Now we are ready to begin coding&#8230;</p>
<h2>Create IBOutlets and IBActions</h2>
<p>Before we create the interface for our web browser, we need to establish the IBOutles and Actions to interface with the UI elements in code.  Start by opening up iCodeBrowserViewController.h and add the following code:</p>
<p style="text-align: center; "><img class="alignnone size-full wp-image-554" title="screenshot_06" src="http://icodeblog.com/wp-content/uploads/2008/12/screenshot_06.png" alt="screenshot_06" width="480" height="248" /></p>
<p style="text-align: left; ">Let&#8217;s take a look at this code line by line.  The first thing we added was the <strong>&lt;UIWebViewDelegate&gt;</strong> to the end of our interface declaration.  This is telling the app that this class will be the delegate for our UIWebview.  </p>
<p style="text-align: left; ">What does it mean to be the delegate you ask? Great question&#8230; A delegate is like a handler.  It is responsible for implementing certain methods in order to handle events sent by the object they are the delegate for.  So in our example, we are simply saying that we will implement some of the functionality of the UIWebView.  This is needed so we can capture certain actions of the UIWebView such as a click on a link or so we can tell when a page has started/finished loading.  If it&#8217;s still unclear, ask me clarifying questions in the comments section.</p>
<p style="text-align: left; ">Next, we see our 3 lines of declaring IBOutlets.  These are the UI elements that we will be interacting with.  In case you didn&#8217;t know, the UIActivityIndicator is the little spinner/loading animation that you see on various apps when content is loading.  We will be using this to show that a page is currently loading.</p>
<p style="text-align: left; ">Following this code, there are 3 IBActions.  IBActions are functions that get called in response to a user interaction with the application (such as tapping a button).  For our basic browser, we are only offering 3 types of functionality.  gotoAddress which will take a user to the address they type in the address bar and goBack/Forward should be pretty self explanatory.  </p>
<h2>Creating the User Interface </h2>
<p style="text-align: left; ">Now, let&#8217;s create the interface using Interface Builder.  I am going to be showing you how to do this in the video below.</p>
<p style="text-align: left; "> </p>
<p>
<script type="text/javascript">
<!--
var ourTags='';
ourTags+='<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="576" HEIGHT="432" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">';
ourTags+='<PARAM name="SRC" VALUE="http://icodeblog.com/wp-content/uploads/2008/12/UIWebView.mov" />';
ourTags+='<PARAM name="CONTROLLER" VALUE="true" />';
ourTags+='<PARAM name="AUTOPLAY" VALUE="false" />';
ourTags+='<PARAM name="SCALE" VALUE="ASPECT" />';
ourTags+='<EMBED ';
ourTags+='SRC="http://icodeblog.com/wp-content/uploads/2008/12/UIWebView.mov" CONTROLLER="true"';
ourTags+=' type="video/quicktime" WIDTH="576" HEIGHT="432" AUTOPLAY="false" SCALE="ASPECT" PLUGINSPAGE="http://www.apple.com/quicktime/download/"></EMBED>';
ourTags+='</OBJECT>';
if (typeof writeTags == "undefined") { document.write(ourTags);} else {writeTags(ourTags);
}//-->
</script>
<noscript>
<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="576" HEIGHT="432" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">
<PARAM name="SRC" VALUE="http://icodeblog.com/wp-content/uploads/2008/12/UIWebView.mov" />
<PARAM name="CONTROLLER" VALUE="true" />
<PARAM name="AUTOPLAY" VALUE="false" />
<PARAM name="SCALE" VALUE="ASPECT" />
<EMBED 
SRC="http://icodeblog.com/wp-content/uploads/2008/12/UIWebView.mov" CONTROLLER="true"
 type="video/quicktime" WIDTH="576" HEIGHT="432" AUTOPLAY="false" SCALE="ASPECT" PLUGINSPAGE="http://www.apple.com/quicktime/download/"></EMBED>
</OBJECT>

</noscript>
</p>
<h2>Implementing the IBActions</h2>
<p>Now that we have our interface, let&#8217;s make the app function.  We need to implement our methods.  Open up <strong>iCodeBrowserViewController.m </strong>and add the following code.</p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2008/12/screenshot_01.png"><img class="alignnone size-full wp-image-570" title="screenshot_01" src="http://icodeblog.com/wp-content/uploads/2008/12/screenshot_01.png" alt="screenshot_01" width="318" height="49" /></a></p>
<p style="text-align: left; ">We need to synthesize our properties to allow us to interact with them.  Synthesizing automatically creates &#8220;getter&#8221; and &#8220;setter&#8221; methods for our properties.  Next, let&#8217;s implement the viewDidLoad method.  This is where we will be loading our &#8220;homepage&#8221;.  Add the following code to the viewDidLoad method.</p>
<p style="text-align: center; "><img class="alignnone size-full wp-image-556" title="screenshot_08" src="http://icodeblog.com/wp-content/uploads/2008/12/screenshot_08.png" alt="screenshot_08" width="396" height="159" /></p>
<p style="text-align: left; ">The viewDidLoad method gets called automatically by our application whenever this view first loads.  We can know for sure that it will get called, so we can put our initialization code here.</p>
<p style="text-align: left; ">The first thing we see is the urlAddress string.  This will be our &#8220;homepage&#8221;.   You can change this to any address you wish to start with.  Next, we build a URL object with our string.  We need to do this so we can make a web request.  Following this, we build our web request and load it into the webView.  This will display the homepage inside of our webview.  Finally, we set the text of the address bar to the homepage address.  This part is more for aesthetics to let the user know what page they are on.</p>
<p style="text-align: left; ">Next, we implement the method that we connected to the UITextField&#8217;s DidEndOnExit method gotoAddress.  Add the following code:</p>
<p style="text-align: center; "><img class="alignnone size-full wp-image-557" title="screenshot_09" src="http://icodeblog.com/wp-content/uploads/2008/12/screenshot_09.png" alt="screenshot_09" width="397" height="118" /></p>
<p style="text-align: left; ">This is similar to the code we wrote in the viewDidLoad method, except for the fact that we are getting our URL string from the address bar.  This method gets called when the user presses the &#8220;Go&#8221; button on the keyboard.  The last thing to note here is we call the <strong>[addressBar resignFirstResponder]</strong> method.  This simply tells the app to hide the keyboard when this method gets called.</p>
<p style="text-align: left; ">The implementation of our <strong>Back </strong>and <strong>Forward </strong>methods are pretty easy.  Go ahead and add the following code.</p>
<p style="text-align: center; "><img class="alignnone size-full wp-image-558" title="screenshot_10" src="http://icodeblog.com/wp-content/uploads/2008/12/screenshot_10.png" alt="screenshot_10" width="215" height="103" /></p>
<p style="text-align: left; ">UIWebViews are pretty cool because of the functionality they offer us built right in to them.  We simply call <strong>[webView goBAck]</strong> to go back and <strong>[webView goForward]</strong> to go forward.  This greatly simplifies the interactions with the webview.  If we were to code that functionality from scratch, we would have to create a stack of URLs and continually push and pop them off the stack to keep track of where we need to go.  Thanks Apple for not making us implement this.</p>
<p style="text-align: left; ">Finally, we need to implement the delegate methods for UIWebview.  These methods allow us to write our own code to respond to actions by the UIWebview.  The first methods we will implement are the <strong>webViewDidStartLoad</strong> and the <strong>webViewDidFinishLoad</strong> methods.  We will use these to show and hide the activity indicator. Add the following code:</p>
<p style="text-align: center; "><img class="alignnone size-full wp-image-559" title="screenshot_11" src="http://icodeblog.com/wp-content/uploads/2008/12/screenshot_11.png" alt="screenshot_11" width="317" height="114" /></p>
<p style="text-align: left; ">So when the request is first made for a ULR (before the page starts loading) the <strong>webViewDidStartLoad</strong> method gets called automatically.  We use this opportunity to start our activity indicator to let the user know the page is loading.  If you don&#8217;t have something like this, it simply feels like the app is frozen when in fact, it&#8217;s just loading the page.  Finally, the <strong>webViewDidFinishLoad</strong> method gets called when the page is fully loaded.  After this, we can stop the indicator (and it automatically hides itself).</p>
<p style="text-align: left; ">The very last thing we need to do is define what happens when a user clicks on a link. Add the following method:</p>
<p style="text-align: center; "><img class="alignnone size-full wp-image-561" title="screenshot_13" src="http://icodeblog.com/wp-content/uploads/2008/12/screenshot_13.png" alt="screenshot_13" width="526" height="194" /></p>
<p style="text-align: left; ">This method gets called automatically whenever the user clicks a link.  This method can be very useful if you want to make a native iPhone application that integrates with a web app.  You can use this method to trap the user&#8217;s clicks and have your application respond to web links that get clicked.  In our case, we need it to do 2 things.  The first is to set the text of the address bar to the URL of the link that was clicked on and to load that address into the webview.</p>
<p style="text-align: left; ">One thing to make note of: We do a check to see if the URL scheme is &#8220;http&#8221;. This is to ensure that the user typed http before their URL.  You can add an else statement here that auto prepends the http if the user did not add it.  This would allow you to type in a url such as &#8220;icodeblog.com&#8221; rather than having to type &#8220;http://www.icodeblog.com&#8221;.  I chose to omit it for this tutorial.</p>
<p style="text-align: left; ">Remember, all of this added functionality of a UIWebView can only be gotten if you tell your class that it implements the UIWebViewDelegate protocol as we did in our .h file.</p>
<p style="text-align: left; ">The app should be complete! Click on Build and Go to see this baby in action.  Remember, you must put &#8220;http://&#8221; in front of your URL&#8217;s.  </p>
<p style="text-align: left; ">I hope you have enjoyed this tutorial.  If you have any questions or comments, feel free to leave them in the comments section of this post.  You can download the source <a href="http://icodeblog.com/wp-content/uploads/2008/12/icodebrowser.zip">here</a> . Happy iCoding!</p>
<p style="text-align: left; "> </p>
<p style="text-align: left; "> </p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/gDB988LnQnc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2008/12/19/iphone-coding-learning-about-uiwebviews-by-creating-a-web-browser/feed/</wfw:commentRss>
<enclosure url="http://icodeblog.com/wp-content/uploads/2008/12/UIWebView.mov" length="10646044" type="video/quick" />
		<feedburner:origLink>http://icodeblog.com/2008/12/19/iphone-coding-learning-about-uiwebviews-by-creating-a-web-browser/</feedburner:origLink></item>
		<item>
		<title>Campaign Trail Update</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/rxeUy78EMNM/</link>
		<comments>http://icodeblog.com/2008/12/19/campaign-trail-update/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 21:42:00 +0000</pubDate>
		<dc:creator>rick</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://icodeblog.com/2008/12/19/campaign-trail-update/</guid>
		<description><![CDATA[In compliance with Apple&#8217;s seemingly random censorship, the Campaign Trail is finally ready for sale.  After swapping out the original avatars that resemble somewhat like Obama, Mccain, Clinton, and Palin, the folks at Apple finally relented. Here are the altered and original game screenshots:
Basically, we changed out some hair and skin tones, hairstyle, accessories. [...]]]></description>
			<content:encoded><![CDATA[<p>In compliance with Apple&#8217;s seemingly random censorship, the Campaign Trail is finally ready for sale.  After swapping out the original avatars that resemble somewhat like Obama, Mccain, Clinton, and Palin, the folks at Apple finally relented. Here are the altered and original game screenshots<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_2oC49Om3IJI/SUw6UcHKPeI/AAAAAAAAABo/ZL0ZKjiBqbk/s1600-h/Picture+2.png" onclick="pageTracker._trackPageview('/outgoing/2.bp.blogspot.com/_2oC49Om3IJI/SUw6UcHKPeI/AAAAAAAAABo/ZL0ZKjiBqbk/s1600-h/Picture+2.png?referer=');"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 181px; height: 260px;" src="http://2.bp.blogspot.com/_2oC49Om3IJI/SUw6UcHKPeI/AAAAAAAAABo/ZL0ZKjiBqbk/s320/Picture+2.png" alt="" id="BLOGGER_PHOTO_ID_5281660585816767970" border="0" /></a>:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_2oC49Om3IJI/SUw6d5YVOcI/AAAAAAAAABw/8xKd1G-g2nc/s1600-h/Picture+3.png" onclick="pageTracker._trackPageview('/outgoing/3.bp.blogspot.com/_2oC49Om3IJI/SUw6d5YVOcI/AAAAAAAAABw/8xKd1G-g2nc/s1600-h/Picture+3.png?referer=');"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 183px; height: 263px;" src="http://3.bp.blogspot.com/_2oC49Om3IJI/SUw6d5YVOcI/AAAAAAAAABw/8xKd1G-g2nc/s320/Picture+3.png" alt="" id="BLOGGER_PHOTO_ID_5281660748292241858" border="0" /></a></p>
<p>Basically, we changed out some hair and skin tones, hairstyle, accessories.  But I am still floored by the fact that the application was rejected the first time around.  Apple claims that I am ridiculing public figures.  However, I can just as easily say that blond guy is Eminem.  But Eminem is also a public figure&#8230; does it make it OK?  If people can get offended by a cartoon that looks like Obama smiling, couldn&#8217;t there also be people offended by a grinning cartoon of Eminem?</p>
<p>The irony is that the figure in the screenshot is NOT Eminem.  What I am trying to point out is that these avatars can really look like anyone you want them to.  If we are not able to depiction of certain public figures in the game, then no game is safe from displaying anything that resembles human.  Doesn&#8217;t it sound crazy to you?  It does to me.</p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/rxeUy78EMNM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2008/12/19/campaign-trail-update/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2008/12/19/campaign-trail-update/</feedburner:origLink></item>
		<item>
		<title>Apple woe and Apple whoa!</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/HLDuRtMyJrU/</link>
		<comments>http://icodeblog.com/2008/12/12/apple-woe-and-apple-whoa/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 20:06:00 +0000</pubDate>
		<dc:creator>rick</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://icodeblog.com/2008/12/12/apple-woe-and-apple-whoa/</guid>
		<description><![CDATA[For the most part, I would like to believe the Apple employees in general have pretty good heads on their shoulders.  If anything, you would have expected some open-mindedness from a company that claims to be dynamic and innovative in nature.  Sadly, the opposite is exactly what we’ve experienced from the folks at [...]]]></description>
			<content:encoded><![CDATA[<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_2oC49Om3IJI/SULFSkb9azI/AAAAAAAAABI/ODayq-bKD9c/s1600-h/pvp_title.jpg" onclick="pageTracker._trackPageview('/outgoing/4.bp.blogspot.com/_2oC49Om3IJI/SULFSkb9azI/AAAAAAAAABI/ODayq-bKD9c/s1600-h/pvp_title.jpg?referer=');"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 139px; height: 256px;" src="http://4.bp.blogspot.com/_2oC49Om3IJI/SULFSkb9azI/AAAAAAAAABI/ODayq-bKD9c/s320/pvp_title.jpg" alt="" id="BLOGGER_PHOTO_ID_5278998636040907570" border="0" /></a><br />For the most part, I would like to believe the Apple employees in general have pretty good heads on their shoulders.  If anything, you would have expected some open-mindedness from a company that claims to be dynamic and innovative in nature.  Sadly, the opposite is exactly what we’ve experienced from the folks at Apple.</p>
<p>No one will argue that last presidential election is historically insignificant.  In many different ways, the entire election campaign, from the primary to the final election result, has meant something special to most of us. In honoring this special occasion, we at RightSprite decided to create a commemorative iPhone game that is both family friendly and light-hearted.</p>
<p>We’ve selected one of the most popular genres &#8212; match three puzzle &#8212; and gave it an election theme.  Instead of matching 3 jewels in a row, you would match 3 voters of the same<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_2oC49Om3IJI/SULGCnZ0KiI/AAAAAAAAABg/NxOTS7caXFM/s1600-h/pvp_gameplay_2chain.jpg" onclick="pageTracker._trackPageview('/outgoing/3.bp.blogspot.com/_2oC49Om3IJI/SULGCnZ0KiI/AAAAAAAAABg/NxOTS7caXFM/s1600-h/pvp_gameplay_2chain.jpg?referer=');"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 173px; height: 320px;" src="http://3.bp.blogspot.com/_2oC49Om3IJI/SULGCnZ0KiI/AAAAAAAAABg/NxOTS7caXFM/s320/pvp_gameplay_2chain.jpg" alt="" id="BLOGGER_PHOTO_ID_5278999461470939682" border="0" /></a> face to get the points.  You are able to select an avatar and you will share the same board as the computer component.  Now, we are fairly cognizant of the fact that some people may feel more sensitive about the topic, so we deliberately made cartoon versions of the candidates and removed the names.  We balanced gender by having 2 male and 2 female candidates.  We also made sure that there are two “blue” avatars for the Democrat party and two “red” avatars for the Republican party.  Finally, in lieu of catching all the election hype and try to cash in on it, we decided that we would launch the game after the election is over and make it free.</p>
<p>We submitted the app last week, and last night we got a courteous reject email from Apple.  Why?  According to Apple, our application contains “obscene, pornographic, offensive or defamatory content or materials of any kind (text, graphics, images, photographs, etc.), or other content or materials that in Apple&#8217;s reasonable judgement may be found objectionable by iPhone or iPod touch users.&#8221;  To fix this issue, Apple suggested that we should “remove the caricatures of public figures from the application.”</p>
<p>After taking all the precautions, my initial reaction was that I found this to be exceedingly offensive. Other than the game is loosely themed politically, there isn’t an objectionable thing the application I can think of.  Would it have been less of a caricature if we had used real photos?  I think not.   And, what if we had accessorized the <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_2oC49Om3IJI/SULF4CT8KFI/AAAAAAAAABY/CaiVQd33tPQ/s1600-h/pvp_new_game.jpg" onclick="pageTracker._trackPageview('/outgoing/1.bp.blogspot.com/_2oC49Om3IJI/SULF4CT8KFI/AAAAAAAAABY/CaiVQd33tPQ/s1600-h/pvp_new_game.jpg?referer=');"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 173px; height: 320px;" src="http://1.bp.blogspot.com/_2oC49Om3IJI/SULF4CT8KFI/AAAAAAAAABY/CaiVQd33tPQ/s320/pvp_new_game.jpg" alt="" id="BLOGGER_PHOTO_ID_5278999279715493970" border="0" /></a>candidates with glasses or mustaches?  Would that have been any more respectful?</p>
<p>There is no doubt that the when players pick up this game, they will immediately make that association between the avatars in the game and the current events.   Indeed, this is what we intended to do as the game itself is a commemorative piece.  Without the avatars, the application is really nothing more than a mediocre rehash of a match three game.</p>
<p>Many of us have heard about and read the horror stories about submitting applications to Apple. We had up to this point been blissfully unscathed by the Apple AppPolice. Our streak has now run out and we have our own cautionary tale for other developers out there. Hopefully you&#8217;ll sense Apple&#8217;s logic in the censoring of our caricatures and be able to avoid making our mistake in your own apps. In the meantime, we&#8217;re back to the drawing board and we will <span style="font-weight: bold;">keep you posted</span>. Comments welcome.</p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/HLDuRtMyJrU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2008/12/12/apple-woe-and-apple-whoa/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2008/12/12/apple-woe-and-apple-whoa/</feedburner:origLink></item>
		<item>
		<title>The “Digg” of iPhone Apps - Checkout My New Site</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/E1zRs5jNG-0/</link>
		<comments>http://icodeblog.com/2008/11/15/the-digg-of-iphone-apps-checkout-my-new-site/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 19:00:02 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[iPhone Articles]]></category>

		<category><![CDATA[fresh iphone apps]]></category>

		<category><![CDATA[freshapps]]></category>

		<category><![CDATA[iPhone apps]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=546</guid>
		<description><![CDATA[
It has been a while since my last tutorial.  For that I am sorry.  My wife is 9 months pregnant and about ready to pop.  This being the case, she takes up most of my free time&#8230; I have spent a little of my extra time developing a new iphone apps site called freshapps.com.
The site [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.freshapps.com" onclick="pageTracker._trackPageview('/outgoing/www.freshapps.com?referer=');"><img class="alignnone size-full wp-image-547" title="iPhone Apps - Fresh Apps" src="http://icodeblog.com/wp-content/uploads/2008/11/fa.png" alt="" width="293" height="133" /></a></p>
<p>It has been a while since my last tutorial.  For that I am sorry.  My wife is 9 months pregnant and about ready to pop.  This being the case, she takes up most of my free time&#8230; I have spent a little of my extra time developing a new <a href="http://www.freshapps.com/" onclick="pageTracker._trackPageview('/outgoing/www.freshapps.com/?referer=');">iphone apps</a> site called <a href="http://www.freshapps.com/" onclick="pageTracker._trackPageview('/outgoing/www.freshapps.com/?referer=');">freshapps.com</a>.</p>
<p>The site uses Wordpress as its main engine and aims to be a &#8220;Digg-like&#8221; site for <a href="http://www.freshapps.com/" onclick="pageTracker._trackPageview('/outgoing/www.freshapps.com/?referer=');">iphone apps</a>. It offers a new fun way to discover the &#8220;freshest&#8221; iphone apps without having to get buried in the app store.  I wrote a pretty slick homepage algorithm that aids in doing this.  </p>
<p>Check it out and let me know what you think! I will be continuing with the iPhone programming tutorials after my baby is born.  This should be mid December.  I am sorry for the delay.  I will still be on answering questions you guys might have and try to get back into the forums.</p>
<p>Thanks for being a part of iCodeBlog. Happy iCoding!</p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/E1zRs5jNG-0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2008/11/15/the-digg-of-iphone-apps-checkout-my-new-site/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2008/11/15/the-digg-of-iphone-apps-checkout-my-new-site/</feedburner:origLink></item>
		<item>
		<title>A Great iPhone Coding Resource</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/uLl4eBYNO0Q/</link>
		<comments>http://icodeblog.com/2008/11/05/a-great-iphone-coding-resource/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 18:42:03 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[iPhone Articles]]></category>

		<category><![CDATA[iPhone apps]]></category>

		<category><![CDATA[iPhone Coding]]></category>

		<category><![CDATA[iphone development]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=544</guid>
		<description><![CDATA[I&#8217;m sure many of you are aware that Stanford is offering an iPhone development class this semester.   On my journeys through the interwebs, I discovered a link to the site where the lectures for this class were posted (via delicious).  
So for those of you who already didn&#8217;t know this, here is a link [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sure many of you are aware that <a href="http://www.tuaw.com/2008/07/23/stanford-to-offer-iphone-programming-course/" onclick="pageTracker._trackPageview('/outgoing/www.tuaw.com/2008/07/23/stanford-to-offer-iphone-programming-course/?referer=');">Stanford is offering an iPhone development class</a> this semester.   On my journeys through the interwebs, I discovered a link to the site where the lectures for this class were posted (via delicious).  </p>
<p>So for those of you who already didn&#8217;t know this, here is a link to the lecture slides (with sample code).</p>
<p><a href="http://www.stanford.edu/class/cs193p/cgi-bin/index.php" onclick="pageTracker._trackPageview('/outgoing/www.stanford.edu/class/cs193p/cgi-bin/index.php?referer=');">http://www.stanford.edu/class/cs193p/cgi-bin/index.php</a></p>
<p>I hope you find the examples and instruction here very useful. Have a great day and happy iCoding!</p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/uLl4eBYNO0Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2008/11/05/a-great-iphone-coding-resource/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2008/11/05/a-great-iphone-coding-resource/</feedburner:origLink></item>
		<item>
		<title>Finding Substrings in Objective-C</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/qsQ-Bkg84F4/</link>
		<comments>http://icodeblog.com/2008/11/03/finding-substrings-in-objective-c/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 05:57:00 +0000</pubDate>
		<dc:creator>josh</dc:creator>
		
		<category><![CDATA[iphone]]></category>

		<category><![CDATA[objective-c]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://icodeblog.com/2008/11/03/finding-substrings-in-objective-c/</guid>
		<description><![CDATA[It&#8217;s times like this, that I miss ruby.
I&#8217;m checking a url to see if it has a substring.  It would be so easy if this was ruby:
absolute_url.match(/my regex/).any?
In Objective C, you have to use rangeOfString which returns a range.  If I were to run this on the string &#8220;the quick brown fox&#8221; with [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s times like this, that I miss ruby.</p>
<p>I&#8217;m checking a url to see if it has a substring.  It would be so easy if this was ruby:
<pre>absolute_url.match(/my regex/).any?</pre>
<p>In Objective C, you have to use rangeOfString which returns a range.  If I were to run this on the string <span style="font-style: italic;">&#8220;the quick brown fox&#8221;</span> with an argument of <span style="font-style: italic;">&#8220;brown&#8221;</span> it would return <span style="font-style: italic;">{10,14}</span>.  If it&#8217;s not found, it would return <span style="font-style: italic;">{NSNotFound, 0}</span>.  Let&#8217;s use that to check to see if the range was found.  We&#8217;ll use <span style="font-style: italic;">NSMakeRange</span> to create the <span style="font-style: italic;">NSNotFound</span> range and <span style="font-style: italic;">NSEqualRanges</span> to compare them:
<pre>if(NSEqualRanges(NSMakeRange(NSNotFound, 0), [absoluteURL rangeOfString:@"my_substring"])){   NSLog(@"my_substring not found in absoluteURL %@", absoluteURL);}</pre>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/qsQ-Bkg84F4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2008/11/03/finding-substrings-in-objective-c/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2008/11/03/finding-substrings-in-objective-c/</feedburner:origLink></item>
		<item>
		<title>iPhone Programming Tutorial - Intro to SOAP Web Services</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/fogpA-tRHSs/</link>
		<comments>http://icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 02:21:17 +0000</pubDate>
		<dc:creator>Brandon</dc:creator>
		
		<category><![CDATA[iPhone Programming Tutorials]]></category>

		<category><![CDATA[iphone]]></category>

		<category><![CDATA[iphone codeing]]></category>

		<category><![CDATA[soap]]></category>

		<category><![CDATA[web services]]></category>

		<category><![CDATA[xml-rpc]]></category>

		<guid isPermaLink="false">http://icodeblog.com/?p=531</guid>
		<description><![CDATA[
This tutorial was contributed by Dave (AKA Clarke76) on the Forums.
WebSite: http://viium.com
 -Main project on site is eDuo. A .Net app that connects to OWA Exchange and forwards to IMAP account. Free program for those who can&#8217;t use Active Sync
 
Important Links:
[WebService] http://viium.com/WebService/HelloWorld.asmx
http://developer.apple.com/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html
http://developer.apple.com/documentation/Cocoa/Conceptual/XMLParsing/XMLParsing.html
http://www.w3schools.com/soap/default.asp
 














-After creating our XML data / SOAP  request, we create a URLRequest. We add [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-medium wp-image-540" title="screenshot_01" src="http://icodeblog.com/wp-content/uploads/2008/11/screenshot_01-300x225.png" alt="" width="300" height="225" style="display:none;" /></p>
<p>This tutorial was contributed by Dave (AKA Clarke76) on the Forums.</p>
<p>WebSite: <a href="http://viium.com" onclick="pageTracker._trackPageview('/outgoing/viium.com?referer=');">http://viium.com</a></p>
<p><span> </span>-Main project on site is eDuo. A .Net app that connects to OWA Exchange and forwards to IMAP account. Free program for those who can&#8217;t use Active Sync</p>
<p> <br />
<strong>Important Links:</strong></p>
<p>[WebService] <a href="http://viium.com/WebService/HelloWorld.asmx" onclick="pageTracker._trackPageview('/outgoing/viium.com/WebService/HelloWorld.asmx?referer=');">http://viium.com/WebService/HelloWorld.asmx</a></p>
<p><a href="http://developer.apple.com/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html" onclick="pageTracker._trackPageview('/outgoing/developer.apple.com/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html?referer=');">http://developer.apple.com/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html</a></p>
<p><a href="http://developer.apple.com/documentation/Cocoa/Conceptual/XMLParsing/XMLParsing.html" onclick="pageTracker._trackPageview('/outgoing/developer.apple.com/documentation/Cocoa/Conceptual/XMLParsing/XMLParsing.html?referer=');">http://developer.apple.com/documentation/Cocoa/Conceptual/XMLParsing/XMLParsing.html</a></p>
<p><a href="http://www.w3schools.com/soap/default.asp" onclick="pageTracker._trackPageview('/outgoing/www.w3schools.com/soap/default.asp?referer=');">http://www.w3schools.com/soap/default.asp</a></p>
<p> 
<script type="text/javascript">
<!--
var ourTags='';
ourTags+='<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="640" HEIGHT="416" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">';
ourTags+='<PARAM name="SRC" VALUE="http://icodeblog.com/wp-content/uploads/2008/11/SOAPTutorial.mov" />';
ourTags+='<PARAM name="CONTROLLER" VALUE="true" />';
ourTags+='<PARAM name="AUTOPLAY" VALUE="false" />';
ourTags+='<PARAM name="SCALE" VALUE="ASPECT" />';
ourTags+='<EMBED ';
ourTags+='SRC="http://icodeblog.com/wp-content/uploads/2008/11/SOAPTutorial.mov" CONTROLLER="true"';
ourTags+=' type="video/quicktime" WIDTH="640" HEIGHT="416" AUTOPLAY="false" SCALE="ASPECT" PLUGINSPAGE="http://www.apple.com/quicktime/download/"></EMBED>';
ourTags+='</OBJECT>';
if (typeof writeTags == "undefined") { document.write(ourTags);} else {writeTags(ourTags);
}//-->
</script>
<noscript>
<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="640" HEIGHT="416" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">
<PARAM name="SRC" VALUE="http://icodeblog.com/wp-content/uploads/2008/11/SOAPTutorial.mov" />
<PARAM name="CONTROLLER" VALUE="true" />
<PARAM name="AUTOPLAY" VALUE="false" />
<PARAM name="SCALE" VALUE="ASPECT" />
<EMBED 
SRC="http://icodeblog.com/wp-content/uploads/2008/11/SOAPTutorial.mov" CONTROLLER="true"
 type="video/quicktime" WIDTH="640" HEIGHT="416" AUTOPLAY="false" SCALE="ASPECT" PLUGINSPAGE="http://www.apple.com/quicktime/download/"></EMBED>
</OBJECT>

</noscript>
</p>
<p>-After creating our XML data / SOAP  request, we create a URLRequest. We add HTTP Header values, those values you read from the WebService.</p>
<p>-We set the HTTP Method to POST</p>
<p>-We set out HTTP Body to the xml file we created</p>
<p>-We then create our connection, using the request we just setup.</p>
<p> </p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2008/11/connection-setup.png"><img class="size-full wp-image-536 aligncenter" title="connection-setup" src="http://icodeblog.com/wp-content/uploads/2008/11/connection-setup.png" alt="" width="500" height="139" /></a></p>
<p> </p>
<p>-Once the connection is setup and delegate is set to self, we need to setup out connection delegate methods.</p>
<p>-The first method just makes sure it can make a connection. If it can, we make sure we have no data in our Data set so we clear it.</p>
<p>-Second method is called when re receive any data. If we do receive data, we just append it to our data set.</p>
<p>-Third Method handles any errors and releases our data and connection if an error occurs.</p>
<p>-Fourth Method: We take the data and create a string for Logging reasons, then release the string.</p>
<p><span> </span>-We check to make sure an instance of xmlParser does not exist, if it does we release it.</p>
<p><span> </span>-Create a new instance of xmlParser, set the delegate to self, want to resolve external entities, and start our parsing.</p>
<p><span> </span>-release our connection and Data</p>
<p> </p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2008/11/2-urlconnectiondelegate.png"><img class="alignnone size-full wp-image-537" title="2-urlconnectiondelegate" src="http://icodeblog.com/wp-content/uploads/2008/11/2-urlconnectiondelegate.png" alt="" width="500" height="321" /></a></p>
<p> </p>
<p>Now we need to our our delegate methods for NSXMLParser</p>
<p>First method we are check the start of elements. If our element equals &#8220;HelloResult&#8221; we set our BOOL to true.  Second method records any data between an element if our BOOL is set to true.  Third method checks for our closing element. Once found sets our greeting, releases our MutableString, and set our BOOL back to false.</p>
<p> </p>
<p style="text-align: center; "><a href="http://icodeblog.com/wp-content/uploads/2008/11/3-xmlparserdelegate.png"><img class="alignnone size-full wp-image-538" title="3-xmlparserdelegate" src="http://icodeblog.com/wp-content/uploads/2008/11/3-xmlparserdelegate.png" alt="" width="500" height="243" /></a></p>
<p style="text-align: left; ">If you have any questions or comments, please leave them in the comments of this post.  You can download the sample code <a href="http://icodeblog.com/wp-content/uploads/2008/11/hello_soap.zip">here.</a></p>
<p style="text-align: left; "> </p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/fogpA-tRHSs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/feed/</wfw:commentRss>
<enclosure url="http://icodeblog.com/wp-content/uploads/2008/11/SOAPTutorial.mov" length="68889891" type="video/quick" />
		<feedburner:origLink>http://icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/</feedburner:origLink></item>
		<item>
		<title>iPhone: applicationDidFinishLaunching &amp; handleOpenUrl</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/QseABXF8e4Q/</link>
		<comments>http://icodeblog.com/2008/11/03/iphone-applicationdidfinishlaunching-handleopenurl/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 15:39:00 +0000</pubDate>
		<dc:creator>josh</dc:creator>
		
		<category><![CDATA[iphone applicationDidFinishLaunching handleOpenUrl]]></category>

		<guid isPermaLink="false">http://icodeblog.com/2008/11/03/iphone-applicationdidfinishlaunching-handleopenurl/</guid>
		<description><![CDATA[Problem:
You use the applicationDidFinishLaunching method to kick off your application.  This event fires automatically on your delegate whenever your app launches.
If your app launches from a special url schema (tel://, http://, mailto://), then another event is fired:
handleOpenUrl
As you might have noticed in the LaunchMe sample project that ships with Xcode, these two methods will [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-weight: bold;">Problem:</span></p>
<p>You use the <span style="font-style: italic;">applicationDidFinishLaunching</span> method to kick off your application.  This event fires automatically on your delegate whenever your app launches.</p>
<p>If your app launches from a special url schema (tel://, http://, mailto://), then another event is fired:</p>
<p><span style="font-style: italic;">handleOpenUrl</span></p>
<p>As you might have noticed in the LaunchMe sample project that ships with Xcode, these two methods will most likely conflict.</p>
<p><span style="font-weight: bold;">Solution:</span></p>
<p>Move the functionality from <span style="font-style: italic;">applicationDidFinishLaunching</span> and put it in another method, like <span style="font-style: italic;">postLaunch</span>.  Then add a member variable to the application delegate to keep track of how the app started:</p>
<pre>@interface YourAppDelegate : NSObject <uiapplicationdelegate> {BOOL launchDefault;}

@property BOOL launchDefault;</uiapplicationdelegate></pre>
<p>Then put this in <span style="font-style: italic;">applicationDidFinishLaunching</span>:</p>
<pre>launchDefault = YES;[self performSelector:@selector(postFinishLaunch) withObject:nil afterDelay:0.0];</pre>
<p>Then in <span style="font-style: italic;">handleOpenUrl</span>, add this:
<pre>launchDefault = NO;</pre>
<p>Lastly, write the postLaunch method and make it check the launchDefault variable.
<pre>- (void)postLaunch{ if (launchDefault){     // Add your functionality from applicationDidFinishLaunching here. }else{     // don't do anything....let handleOpenURL run }

}</pre>
<p><span style="font-weight: bold;">How does this work?</span></p>
<p>You&#8217;re effectively adding a method to the event chain to be called after all other events.  You&#8217;re putting a 0 second delay on it, so it shouldn&#8217;t add any extra time to the overall loading time.</p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/QseABXF8e4Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2008/11/03/iphone-applicationdidfinishlaunching-handleopenurl/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2008/11/03/iphone-applicationdidfinishlaunching-handleopenurl/</feedburner:origLink></item>
		<item>
		<title>Xcode SDK / iPhone OS Idiosyncracies</title>
		<link>http://feedproxy.google.com/~r/icodeblog/~3/fC_IMWBVcbg/</link>
		<comments>http://icodeblog.com/2008/11/02/xcode-sdk-iphone-os-idiosyncracies/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 17:32:00 +0000</pubDate>
		<dc:creator>josh</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://icodeblog.com/2008/11/02/xcode-sdk-iphone-os-idiosyncracies/</guid>
		<description><![CDATA[The Problem:
Recently, after upgrading an iPhone to the current iPhone development firmware Xcode was unable to detect the device.  I first noticed this when trying to build directly to the device:
&#8220;no provisioned iphone os device connected&#8221;.  Needless to say, the device was in fact connected.
After that, I opened the organizer and saw:
&#8220;unable to [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-weight: bold;">The Problem:</span></p>
<p>Recently, after upgrading an iPhone to the current iPhone development firmware Xcode was unable to detect the device.  I first noticed this when trying to build directly to the device:</p>
<p>&#8220;no provisioned iphone os device connected&#8221;.  Needless to say, the device was in fact connected.</p>
<p>After that, I opened the organizer and saw:</p>
<p>&#8220;unable to locate a suitable developer disk image&#8230;&#8221;.</p>
<p><span style="font-weight: bold;">The Solution:</span></p>
<p>Downloading and installing the current Xcode SDK.  Wouldn&#8217;t it be helpful if the error message could tell you that?<br /><em></em></p>
<img src="http://feeds.feedburner.com/~r/icodeblog/~4/fC_IMWBVcbg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://icodeblog.com/2008/11/02/xcode-sdk-iphone-os-idiosyncracies/feed/</wfw:commentRss>
		<feedburner:origLink>http://icodeblog.com/2008/11/02/xcode-sdk-iphone-os-idiosyncracies/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 8.180 seconds. --><!-- Cached page generated by WP-Super-Cache on 2009-07-10 00:10:56 -->
