<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6060997494574537540</id><updated>2011-11-28T01:11:28.829+01:00</updated><category term='Base'/><category term='Programmatically'/><category term='CGContext'/><category term='Software Engineering'/><category term='Xcode'/><category term='Button'/><category term='Game'/><category term='Save'/><category term='IT'/><category term='Simple'/><category term='Web page'/><category term='Tutorial'/><category term='Apple'/><category term='Objective C'/><category term='done editing'/><category term='Computer'/><category term='Graphics'/><category term='Resign First Responder'/><category term='Core Animation'/><category term='Convert'/><category term='keyboard'/><category term='Game Tutorial'/><category term='UIImage'/><category term='Decimal'/><category term='Save Data'/><category term='Animation'/><category term='Image compression'/><category term='Quartz'/><category term='Image file formats'/><category term='Animate'/><category term='Rambo'/><category term='System'/><category term='iPhone SDK'/><category term='disapear'/><category term='IPhone OS'/><category term='JPEG'/><category term='iPhone Memory'/><category term='Library'/><category term='Quartz 2D'/><category term='Sprites'/><category term='Engineering'/><category term='Quartz Core'/><category term='Academia'/><category term='iPhone 3.0'/><category term='Matrix'/><category term='SDK'/><category term='Binary'/><category term='Germany'/><category term='Development'/><category term='Number'/><category term='iPhone'/><category term='Guide'/><category term='UIImageView'/><category term='Memory'/><category term='Smartphones'/><category term='Window'/><category term='total training'/><category term='Handhelds'/><category term='Interface Builder'/><title type='text'>JC Developer World</title><subtitle type='html'>I'm starting a career as a Software Engineer. This is my blog. I hope to help others out with everything I'm learning.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jcdeveloperworld.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jcdeveloperworld.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>JC</name><uri>http://www.blogger.com/profile/17673323321116004458</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_GcGZbzhP2ig/Sh5PAa43UkI/AAAAAAAAAJw/A-uLMPhe994/s1600-R/n606455606_244.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6060997494574537540.post-3544082022971749572</id><published>2010-07-01T15:17:00.000+02:00</published><updated>2010-07-01T15:17:23.869+02:00</updated><title type='text'>[Web] Googles Web fonts</title><content type='html'>Often, when comparing websites in different browsers, its also a good idea to check how they look in different OS. It can be very depressing.&lt;br /&gt;Or maybe you want to add a nicer font and not those boring web standard fonts to your website.&lt;br /&gt;That's where the Google Web fonts come in handy.&lt;br /&gt;&lt;br /&gt;Google provides a set of Fonts from which you can choose from and returns you a code-snipped. The snipped will look something like this:&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&lt; link href="http://fonts.googleapis.com/css?family=%3Cspan%20id=%22url%22%3E%3Cstrong%3ETangerine%3C/strong%3E%3C/span%3E" rel="stylesheet" type="text/css"&gt;&lt;/ link &gt;&lt;/span&gt;&lt;/blockquote&gt;Add this code to your Header and you're good to go set the font to (in this case) Tangerine in your CSS file.&lt;br /&gt;&lt;br /&gt;This way you can not only make sure the fonts look similar on every system, but you can also choose fonts that aren't web standard.&lt;br /&gt;&lt;br /&gt;This Google Project is still in heavy development but it might evolve in something really nice for web developers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6060997494574537540-3544082022971749572?l=jcdeveloperworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://code.google.com/webfonts' title='[Web] Googles Web fonts'/><link rel='replies' type='application/atom+xml' href='http://jcdeveloperworld.blogspot.com/feeds/3544082022971749572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jcdeveloperworld.blogspot.com/2010/07/web-googles-web-fonts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/3544082022971749572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/3544082022971749572'/><link rel='alternate' type='text/html' href='http://jcdeveloperworld.blogspot.com/2010/07/web-googles-web-fonts.html' title='[Web] Googles Web fonts'/><author><name>JC</name><uri>http://www.blogger.com/profile/17673323321116004458</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_GcGZbzhP2ig/Sh5PAa43UkI/AAAAAAAAAJw/A-uLMPhe994/s1600-R/n606455606_244.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6060997494574537540.post-4865002152639417055</id><published>2010-06-29T16:30:00.001+02:00</published><updated>2010-06-29T16:33:24.885+02:00</updated><title type='text'>[CSS] Round Corners</title><content type='html'>As I have noticed, designers like to design a lot of stuff that the developers hate to implement.&lt;br /&gt;One of this things seams to be round corners. Often the developer ends up using images of round corners or other weird methods.&lt;br /&gt;&lt;br /&gt;What only a few people seam to know is that you can get round corners very easy with CSS.&lt;br /&gt;Check this out (each is for a different Browser Toolkit, just include all of them every time you want rounded corners): &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;-moz-border-radius: 5px;&lt;br /&gt;-webkit-border-radius: 5px;&lt;br /&gt;-khtml-border-radius: 5px;&lt;/blockquote&gt;&lt;br /&gt;(Including the "-")&lt;br /&gt;&lt;br /&gt;this should look like this:&lt;br /&gt;&lt;div style="-khtml-border-radius:5px; -webkit-border-radius:5px; -moz-border-radius:5px; border:1px solid white; padding:3px;"&gt;This box should have round corners&lt;/div&gt;&lt;br /&gt;For IE users, fear not! There is a project that does the job too. More info here:&lt;br /&gt;&lt;a href="http://code.google.com/p/curvycorners/"&gt;http://code.google.com/p/curvycorners/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Stay tuned, post about Web Fonts coming soon with another great discovery to finally making the Web beautiful.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6060997494574537540-4865002152639417055?l=jcdeveloperworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jcdeveloperworld.blogspot.com/feeds/4865002152639417055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jcdeveloperworld.blogspot.com/2010/06/css-round-corners.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/4865002152639417055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/4865002152639417055'/><link rel='alternate' type='text/html' href='http://jcdeveloperworld.blogspot.com/2010/06/css-round-corners.html' title='[CSS] Round Corners'/><author><name>JC</name><uri>http://www.blogger.com/profile/17673323321116004458</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_GcGZbzhP2ig/Sh5PAa43UkI/AAAAAAAAAJw/A-uLMPhe994/s1600-R/n606455606_244.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6060997494574537540.post-6885133522347898636</id><published>2009-09-11T16:19:00.000+02:00</published><updated>2009-09-11T16:29:21.464+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Computer'/><category scheme='http://www.blogger.com/atom/ns#' term='Convert'/><category scheme='http://www.blogger.com/atom/ns#' term='Decimal'/><category scheme='http://www.blogger.com/atom/ns#' term='Number'/><category scheme='http://www.blogger.com/atom/ns#' term='Base'/><category scheme='http://www.blogger.com/atom/ns#' term='Matrix'/><category scheme='http://www.blogger.com/atom/ns#' term='IT'/><category scheme='http://www.blogger.com/atom/ns#' term='System'/><category scheme='http://www.blogger.com/atom/ns#' term='Binary'/><title type='text'>[Theory] Number Base System</title><content type='html'>&lt;p class="zemanta-img" style="margin: 1em; float: right; display: block; width: 310px;"&gt;&lt;a href="http://en.wikipedia.org/wiki/Image:Binary_executable_file.png"&gt;&lt;img src="http://upload.wikimedia.org/wikipedia/en/thumb/9/9b/Binary_executable_file.png/300px-Binary_executable_file.png" alt="A hex dump of a binary executable file" style="border: medium none ; display: block;" width="300" height="259" /&gt;&lt;/a&gt;&lt;span class="zemanta-img-attribution"&gt;Image via &lt;a href="http://en.wikipedia.org/wiki/Image:Binary_executable_file.png"&gt;Wikipedia&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;Today we're going to look at the different Number bases and how to convert them. As allways, there are many ways of doing this and these are just my methods.&lt;br /&gt;&lt;br /&gt;We're going to star with the easiest: Binary.&lt;br /&gt;If you are a normal person (more or less) then you tend to think in a 10 base system. This means that there are 10 different signs to represent numbers in your system. Which are: 0,1,2,3,4,5,6,7,8,9. (Notice that 10 isn't a number, its a combination of two).&lt;br /&gt;We call this the Decimal (DEC) system.&lt;br /&gt;&lt;br /&gt;In binary (BIN) there are only two different symbols: 0,1. Its the easiest system to differenciate one number from another. Its either ON or OFF, its BLACK or WHITE, its 1 or 0.&lt;br /&gt;&lt;br /&gt;Obviously, the more symbols we have to represent a number the less we have to write, but if we have very few symbols, like in the binary system, the number strings tend to become somewhat large.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Reading Binary:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Each position in a binary string represents a &lt;span style="font-style: italic;"&gt;weight&lt;/span&gt; or &lt;span style="font-style: italic;"&gt;value&lt;/span&gt;. Lets take this string as an example: [1101]&lt;br /&gt;If there is a 1, we count that value of the position. If there is a 0 we ignor the position.&lt;br /&gt;The values are the following: [1,2,4,8,16,32,64,128,512,1024...].&lt;br /&gt;&lt;br /&gt;If we now  look at our example string, starting from behind (right side), we have a 1. The 1 means we count the value. The Value for the first position (starting from behind) is 1.&lt;br /&gt;Next comes the 0. Second position has the value 2 but we don't count that because of the 0.&lt;br /&gt;Next number is a 1, which means again that we do count the value:4.&lt;br /&gt;The last number in our string is another 1: The fourth position  has a value of 8.&lt;br /&gt;&lt;br /&gt;Now that we have gathered all the values, just add them together and you get the result of what that binary number looks in our decimal base.&lt;br /&gt;1+4+8 = 25.&lt;br /&gt;&lt;br /&gt;And thats how you can read binary.&lt;br /&gt;Next we will check out some conversions from one base to another aswell as the Hexadecimal (16th) base which you might have heared from if you've done some Photoshop.&lt;br /&gt;&lt;div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"&gt;&lt;a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/a5e7dc36-742f-49b6-96ec-bc777136e510/" title="Reblog this post [with Zemanta]"&gt;&lt;img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=a5e7dc36-742f-49b6-96ec-bc777136e510" alt="Reblog this post [with Zemanta]" /&gt;&lt;/a&gt;&lt;span class="zem-script more-related pretty-attribution"&gt;&lt;script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6060997494574537540-6885133522347898636?l=jcdeveloperworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jcdeveloperworld.blogspot.com/feeds/6885133522347898636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/09/theory-number-base-system.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/6885133522347898636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/6885133522347898636'/><link rel='alternate' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/09/theory-number-base-system.html' title='[Theory] Number Base System'/><author><name>JC</name><uri>http://www.blogger.com/profile/17673323321116004458</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_GcGZbzhP2ig/Sh5PAa43UkI/AAAAAAAAAJw/A-uLMPhe994/s1600-R/n606455606_244.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6060997494574537540.post-2129983788686585115</id><published>2009-07-31T16:42:00.016+02:00</published><updated>2009-08-03T14:27:14.411+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='Interface Builder'/><category scheme='http://www.blogger.com/atom/ns#' term='Game'/><category scheme='http://www.blogger.com/atom/ns#' term='Rambo'/><category scheme='http://www.blogger.com/atom/ns#' term='IPhone OS'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone'/><category scheme='http://www.blogger.com/atom/ns#' term='Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='Xcode'/><category scheme='http://www.blogger.com/atom/ns#' term='Animation'/><category scheme='http://www.blogger.com/atom/ns#' term='Game Tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='Core Animation'/><category scheme='http://www.blogger.com/atom/ns#' term='Apple'/><title type='text'>iPhone Game Tutorial (Part 2)</title><content type='html'>Lets add more to this App.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Our Goals today:&lt;/span&gt;&lt;br /&gt;We're going to make a few changes to our previous project. What we're going to be able to do with this app at the end of the tutorial will be:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Move in 3 directions (Up, Down, Right)&lt;/li&gt;&lt;li&gt; Fire (yes!)&lt;/li&gt;&lt;li&gt;Move to different stages&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;So lets start by modifieing our .h:&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;uikit h=""&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;@interface&lt;/span&gt; AnimateViewController : UIViewController {&lt;br /&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;IBOutlet&lt;/span&gt; &lt;span style="color: rgb(102, 0, 204);"&gt;UIImageView&lt;/span&gt;    *&lt;span style="color: rgb(0, 102, 0);"&gt;background&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;IBOutlet&lt;/span&gt; &lt;span style="color: rgb(102, 0, 204);"&gt;UIButton&lt;/span&gt;        *&lt;span style="color: rgb(0, 102, 0);"&gt;buttonUp&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;IBOutlet&lt;/span&gt; &lt;span style="color: rgb(102, 0, 204);"&gt;UIButton&lt;/span&gt;        *&lt;span style="color: rgb(0, 102, 0);"&gt;buttonDown&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;IBOutlet&lt;/span&gt; &lt;span style="color: rgb(102, 0, 204);"&gt;UIButton&lt;/span&gt;        *&lt;span style="color: rgb(0, 102, 0);"&gt;buttonRight&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;IBOutlet&lt;/span&gt; &lt;span style="color: rgb(102, 0, 204);"&gt;UIButton&lt;/span&gt;        *&lt;span style="color: rgb(0, 102, 0);"&gt;buttonFire&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;UIImageView&lt;/span&gt;    *&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;UIImageView&lt;/span&gt;    *&lt;span style="color: rgb(0, 102, 0);"&gt;flash&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;NSArray&lt;/span&gt;        *&lt;span style="color: rgb(0, 102, 0);"&gt;walkImages&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;NSArray&lt;/span&gt;        *&lt;span style="color: rgb(0, 102, 0);"&gt;fireImages&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;NSTimer&lt;/span&gt;        *&lt;span style="color: rgb(0, 102, 0);"&gt;walkingTimer&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;NSTimer&lt;/span&gt;        *&lt;span style="color: rgb(0, 102, 0);"&gt;fireTimer&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;NSUInteger&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0);"&gt;lvl&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;NSUInteger&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0);"&gt;topLimit&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;NSUInteger&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0);"&gt;bottomLimit&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)disableMovementButtons;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)enableMovementButtons;&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)walk;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)stopWalking;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)walkUp;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)stopWalkingUp;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)walkDown;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)stopWalkingDown;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)triggerPulled;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)triggerReleased;&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)startMovingForward;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)moveForward;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)startMovingUp;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)moveUp;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)startMovingDown;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)moveDown;&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)startFireing;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)checkHits;&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)checklvl;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;@end&lt;/span&gt;&lt;/uikit&gt;&lt;/blockquote&gt;As you can see we have some new methods to fill with code, but I've also modified some of the existing ones, so watch for changes.&lt;br /&gt;We create IBOutlets as we will be referring to the background to switch the image in it while we move on in the game, and refer to the buttons to change some properties of them.&lt;br /&gt;We also create a new UIImageView called flash witch will help us animate the gun fire. We then also create an NSTimer to check for hits on the enemies (in future tutorials).&lt;br /&gt;The NSUIntegers I created are to keep track of some numbers, like the level or stage we currently are at or the maximum vertical range we can let our little soldier move on the iPhones screen.&lt;br /&gt;As for the methods, I think the names speak for them self, if not, you'll see when we right the actual code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Changing the xib:&lt;/span&gt;&lt;br /&gt;Open the xib in Interface Builder and make the changes so it looks like on the screenshot below.&lt;br /&gt;&lt;a href="http://picasaweb.google.de/lh/photo/bWef_dgBOxHTc9OUi8CDmg?feat=embedwebsite"&gt;&lt;img src="http://lh4.ggpht.com/_GcGZbzhP2ig/SnbXCGspLGI/AAAAAAAAAUA/ecKn9YKamUU/s144/screenshot.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You will also need:&lt;br /&gt;&lt;table style="width:194px;"&gt;&lt;tr&gt;&lt;td align="center" style="height:194px;background:url(http://picasaweb.google.de/s/c/transparent_album_background.gif) no-repeat left"&gt;&lt;a href="http://picasaweb.google.de/courtois.j/IPhoneGameTutorialPart2?feat=embedwebsite"&gt;&lt;img src="http://lh3.ggpht.com/_GcGZbzhP2ig/SnbWLqn_ApE/AAAAAAAAAUA/t1_rowuYipc/s160-c/IPhoneGameTutorialPart2.jpg" width="160" height="160" style="margin:1px 0 0 4px;"&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="text-align:center;font-family:arial,sans-serif;font-size:11px"&gt;&lt;a href="http://picasaweb.google.de/courtois.j/IPhoneGameTutorialPart2?feat=embedwebsite" style="color:#4D4D4D;font-weight:bold;text-decoration:none;"&gt;iPhone Game Tutorial (Part 2)&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Connect all the IBOutlets to its appropriate Element (buttons and background) and set the following methods:&lt;br /&gt;&lt;br /&gt;buttonRight Touch Down =&gt; Walk&lt;br /&gt;buttonRight Touch Up Inside =&gt; stopWalking&lt;br /&gt;&lt;br /&gt;buttonUp Touch Down =&gt; walkUp&lt;br /&gt;buttonUp Touch Up Inside =&gt; stopWalkingUp&lt;br /&gt;&lt;br /&gt;buttonDown Touch Down =&gt; walkDown&lt;br /&gt;buttonDown Touch Up Inside =&gt; stopWalkingDown&lt;br /&gt;&lt;br /&gt;buttonFire Touch Down =&gt; triggerPulled&lt;br /&gt;buttonFire Touch Up Inside =&gt; triggerReleased&lt;br /&gt;&lt;br /&gt;we can also remove the image from our background as we'll set it later in the code.&lt;br /&gt;And that's it for the xib. Save and close it.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Moving on to the .m:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I've done some changes to the viewDidLoad method&lt;br /&gt;&lt;blockquote&gt;- (&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)viewDidLoad {&lt;br /&gt;[&lt;span style="color: rgb(204, 51, 204);"&gt;super&lt;/span&gt; &lt;span style="color: rgb(51, 0, 153);"&gt;viewDidLoad&lt;/span&gt;];&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;lvl&lt;/span&gt; = &lt;span style="color: rgb(51, 51, 255);"&gt;1&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;topLimit&lt;/span&gt; = &lt;span style="color: rgb(51, 51, 255);"&gt;140&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;bottomLimit&lt;/span&gt; = &lt;span style="color: rgb(51, 51, 255);"&gt;260&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;walkImages&lt;/span&gt; = [[&lt;span style="color: rgb(51, 0, 153);"&gt;NSArray&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;alloc&lt;/span&gt;] &lt;span style="color: rgb(0, 0, 102);"&gt;initWithObjects&lt;/span&gt;:&lt;br /&gt;                    [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"w1.png"&lt;/span&gt;], [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"w2.png"&lt;/span&gt;],&lt;br /&gt;                    [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"w3.png"&lt;/span&gt;], [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"w4.png"&lt;/span&gt;],&lt;br /&gt;                    [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"w5.png"&lt;/span&gt;], [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"w6.png"&lt;/span&gt;], &lt;span style="color: rgb(204, 51, 204);"&gt;nil&lt;/span&gt;];&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt; = [[&lt;span style="color: rgb(51, 0, 153);"&gt;UIImageView&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;alloc&lt;/span&gt;] &lt;span style="color: rgb(0, 0, 102);"&gt;initWithFrame&lt;/span&gt;:&lt;span style="color: rgb(0, 0, 102);"&gt;CGRectMake&lt;/span&gt;(&lt;span style="color: rgb(51, 51, 255);"&gt;100&lt;/span&gt;, &lt;span style="color: rgb(51, 51, 255);"&gt;220&lt;/span&gt;, &lt;span style="color: rgb(51, 51, 255);"&gt;30&lt;/span&gt;, &lt;span style="color: rgb(51, 51, 255);"&gt;30&lt;/span&gt;)];&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.image = [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"stand.png"&lt;/span&gt;];&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.animationDuration = &lt;span style="color: rgb(51, 51, 255);"&gt;1.5&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.contentMode = &lt;span style="color: rgb(0, 0, 102);"&gt;UIViewContentModeBottomLeft&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;fireImages&lt;/span&gt; = [[&lt;span style="color: rgb(51, 0, 153);"&gt;NSArray&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;alloc&lt;/span&gt;] &lt;span style="color: rgb(0, 0, 102);"&gt;initWithObjects&lt;/span&gt;:&lt;br /&gt;                     [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"flash1.png"&lt;/span&gt;],&lt;br /&gt;                     [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"flash2.png"&lt;/span&gt;], &lt;span style="color: rgb(204, 51, 204);"&gt;nil&lt;/span&gt;];&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;flash&lt;/span&gt; = [[&lt;span style="color: rgb(51, 0, 153);"&gt;UIImageView&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;alloc&lt;/span&gt;] &lt;span style="color: rgb(0, 0, 102);"&gt;init&lt;/span&gt;];&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;flash&lt;/span&gt;.animationDuration = &lt;span style="color: rgb(51, 51, 255);"&gt;0.18&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;flash&lt;/span&gt;.contentMode = &lt;span style="color: rgb(0, 0, 102);"&gt;UIViewContentModeBottomLeft&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt;.view &lt;span style="color: rgb(0, 0, 102);"&gt;addSubview&lt;/span&gt;:&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;];&lt;br /&gt;[&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt;.view &lt;span style="color: rgb(0, 0, 102);"&gt;addSubview&lt;/span&gt;:&lt;span style="color: rgb(0, 102, 0);"&gt;flash&lt;/span&gt;];&lt;br /&gt;[&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt; &lt;span style="color: rgb(0, 51, 0);"&gt;checklvl&lt;/span&gt;];&lt;br /&gt;}&lt;/blockquote&gt;As you can see, we've now filled up another array with 2 images and given the new UIImageView some instructions. BUT we haven't actually placed it on the iPhone screen yet (no frame yet).&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(102, 51, 0);"&gt;#pragma mark -&lt;/span&gt; &lt;span style="color: rgb(102, 51, 0);"&gt;#pragma mark My Methods&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)disableMovementButtons {&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonUp&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;NO&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonDown&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;NO&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonRight&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;NO&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)enableMovementButtons {&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonUp&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;YES&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonDown&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;YES&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonRight&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;YES&lt;/span&gt;;&lt;br /&gt;}&lt;/blockquote&gt;When the player is sawing away bullets on hordes of enemies (which don't exist yet) we don't want him to be able to run around like Rambo... and screw around with our o so simple animation. That's why we'll use these two methods to simply dis- enable the buttons.&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(102, 51, 0);"&gt;#pragma mark -&lt;/span&gt; &lt;span style="color: rgb(102, 51, 0);"&gt;#pragma mark IB Actions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)walk {&lt;br /&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;if&lt;/span&gt;(&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.frame.&lt;span style="color: rgb(51, 0, 153);"&gt;origin.y&lt;/span&gt; &gt; &lt;span style="color: rgb(0, 102, 0);"&gt;topLimit&lt;/span&gt; &amp;amp;&amp;amp;&lt;br /&gt;  &lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.frame.&lt;span style="color: rgb(51, 0, 153);"&gt;origin.y&lt;/span&gt; &lt; &lt;span style="color: rgb(0, 102, 0);"&gt;bottomLimit&lt;/span&gt;) {&lt;br /&gt;   [&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt; &lt;span style="color: rgb(0, 51, 0);"&gt;startMovingForward&lt;/span&gt;];&lt;br /&gt;   &lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.animationImages = &lt;span style="color: rgb(0, 102, 0);"&gt;walkImages&lt;/span&gt;;&lt;br /&gt;   [&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt; &lt;span style="color: rgb(51, 0, 153);"&gt;startAnimating&lt;/span&gt;];&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: rgb(0, 102, 0);"&gt;buttonUp&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;NO&lt;/span&gt;;&lt;br /&gt;   &lt;span style="color: rgb(0, 102, 0);"&gt;buttonDown&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;NO&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)stopWalking {&lt;br /&gt;[&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;stopAnimating&lt;/span&gt;];&lt;br /&gt;[&lt;span style="color: rgb(0, 102, 0);"&gt;walkingTimer&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;invalidate&lt;/span&gt;];&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonUp&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;YES&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonDown&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;YES&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)walkUp {&lt;br /&gt;[&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt; &lt;span style="color: rgb(0, 51, 0);"&gt;startMovingUp&lt;/span&gt;];&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.animationImages = &lt;span style="color: rgb(0, 102, 0);"&gt;walkImages&lt;/span&gt;;&lt;br /&gt;[&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;startAnimating&lt;/span&gt;];&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonRight&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;NO&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonDown&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;NO&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)stopWalkingUp {&lt;br /&gt;[&lt;span style="color: rgb(0, 51, 0);"&gt;player&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;stopAnimating&lt;/span&gt;];&lt;br /&gt;[&lt;span style="color: rgb(0, 102, 0);"&gt;walkingTimer&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;invalidate&lt;/span&gt;];&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonRight&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;YES&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonDown&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;YES&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)walkDown {&lt;br /&gt;[&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt; &lt;span style="color: rgb(0, 51, 0);"&gt;startMovingDown&lt;/span&gt;];&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.animationImages = &lt;span style="color: rgb(0, 102, 0);"&gt;walkImages&lt;/span&gt;;&lt;br /&gt;[&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;startAnimating&lt;/span&gt;];&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonUp&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;NO&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonRight&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;NO&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)stopWalkingDown {&lt;br /&gt;[&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;stopAnimating&lt;/span&gt;];&lt;br /&gt;[&lt;span style="color: rgb(0, 102, 0);"&gt;walkingTimer&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;invalidate&lt;/span&gt;];&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonUp&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;YES&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;buttonRight&lt;/span&gt;.&lt;span style="color: rgb(51, 0, 153);"&gt;enabled&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;YES&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)triggerPulled {&lt;br /&gt;[&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;startFireing&lt;/span&gt;];&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;flash&lt;/span&gt;.animationImages = &lt;span style="color: rgb(0, 102, 0);"&gt;fireImages&lt;/span&gt;;&lt;br /&gt;[&lt;span style="color: rgb(0, 102, 0);"&gt;flash&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;startAnimating&lt;/span&gt;];&lt;br /&gt;[&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;disableMovementButtons&lt;/span&gt;];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)triggerReleased {&lt;br /&gt;[&lt;span style="color: rgb(0, 102, 0);"&gt;fireTimer&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;invalidate&lt;/span&gt;];&lt;br /&gt;[&lt;span style="color: rgb(0, 102, 0);"&gt;flash&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;stopAnimating&lt;/span&gt;];&lt;br /&gt;[&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;enableMovementButtons&lt;/span&gt;];&lt;br /&gt;}&lt;/blockquote&gt;All fairly simple and similar to first part of the tutorial. However, we added a little IF to move to the next stage and reset our position when we reach the end of the iPhone screen.&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(102, 51, 0);"&gt;#pragma mark Weapon use&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)startFireing {&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;flash&lt;/span&gt;.frame = &lt;span style="color: rgb(0, 0, 102);"&gt;CGRectMake&lt;/span&gt;((&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.frame.&lt;span style="color: rgb(51, 0, 153);"&gt;origin.x&lt;/span&gt;)+&lt;span style="color: rgb(0, 0, 153);"&gt;30&lt;/span&gt;, (&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.frame.&lt;span style="color: rgb(51, 0, 153);"&gt;origin.y&lt;/span&gt;)+&lt;span style="color: rgb(0, 0, 153);"&gt;10&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 153);"&gt;15&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 153);"&gt;10&lt;/span&gt;);&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;fireTimer&lt;/span&gt; = [&lt;span style="color: rgb(51, 0, 153);"&gt;NSTimer&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;scheduledTimerWithTimeInterval&lt;/span&gt;:&lt;span style="color: rgb(51, 51, 255);"&gt;0.18&lt;/span&gt;&lt;br /&gt;                                          &lt;span style="color: rgb(0, 0, 102);"&gt;target&lt;/span&gt;:&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt;&lt;br /&gt;                                        &lt;span style="color: rgb(0, 0, 102);"&gt;selector&lt;/span&gt;:&lt;span style="color: rgb(204, 51, 204);"&gt;@selector&lt;/span&gt;(&lt;span style="color: rgb(0, 102, 0);"&gt;checkHits&lt;/span&gt;)&lt;br /&gt;                                        &lt;span style="color: rgb(0, 0, 102);"&gt;userInfo&lt;/span&gt;:&lt;span style="color: rgb(204, 51, 204);"&gt;nil&lt;/span&gt;&lt;br /&gt;                                         &lt;span style="color: rgb(0, 0, 102);"&gt;repeats&lt;/span&gt;:&lt;span style="color: rgb(204, 51, 204);"&gt;YES&lt;/span&gt;];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)checkHits {&lt;br /&gt;&lt;br /&gt;}&lt;/blockquote&gt;Here comes the part you've been waiting for! We orientate on the origin of the player frame and displace the flash so that it aligns with the gun barrel. We will not check if we hit anything yet as there isn't anything we could shoot at but we'll get to that in the next tutorial.&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(102, 51, 0);"&gt;#pragma mark -&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 0);"&gt;#pragma mark world events&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)checklvl {&lt;br /&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;switch&lt;/span&gt; (&lt;span style="color: rgb(0, 102, 0);"&gt;lvl&lt;/span&gt;) {&lt;br /&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;case&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;1&lt;/span&gt;:&lt;br /&gt;     &lt;span style="color: rgb(0, 102, 0);"&gt;background&lt;/span&gt;.image = [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"bg1.png"&lt;/span&gt;];&lt;br /&gt;     &lt;span style="color: rgb(204, 51, 204);"&gt;break&lt;/span&gt;;&lt;br /&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;case&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;2&lt;/span&gt;:&lt;br /&gt;     &lt;span style="color: rgb(0, 102, 0);"&gt;background&lt;/span&gt;.image = [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"bg2.png"&lt;/span&gt;];&lt;br /&gt;     topLimit = 170;&lt;br /&gt;     &lt;span style="color: rgb(204, 51, 204);"&gt;break&lt;/span&gt;;&lt;br /&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;case&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;3&lt;/span&gt;:&lt;br /&gt;     &lt;span style="color: rgb(0, 102, 0);"&gt;background&lt;/span&gt;.image = [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"bg3.png"&lt;/span&gt;];&lt;br /&gt;     &lt;span style="color: rgb(204, 51, 204);"&gt;break&lt;/span&gt;;&lt;br /&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;case&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;4&lt;/span&gt;:&lt;br /&gt;     &lt;span style="color: rgb(0, 102, 0);"&gt;background&lt;/span&gt;.image = [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"bg4.png"&lt;/span&gt;];&lt;br /&gt;     &lt;span style="color: rgb(204, 51, 204);"&gt;break&lt;/span&gt;;&lt;br /&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;case&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;5&lt;/span&gt;:&lt;br /&gt;     &lt;span style="color: rgb(0, 102, 0);"&gt;background&lt;/span&gt;.image = [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"bg5.png"&lt;/span&gt;];&lt;br /&gt;     &lt;span style="color: rgb(204, 51, 204);"&gt;break&lt;/span&gt;;&lt;br /&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;case&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;6&lt;/span&gt;:&lt;br /&gt;     &lt;span style="color: rgb(0, 102, 0);"&gt;background&lt;/span&gt;.image = [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"bg6.png"]&lt;/span&gt;;&lt;br /&gt;     &lt;span style="color: rgb(204, 51, 204);"&gt;break&lt;/span&gt;;&lt;br /&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;case&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;7&lt;/span&gt;:&lt;br /&gt;     &lt;span style="color: rgb(0, 102, 0);"&gt;background&lt;/span&gt;.image = [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"bg7.png"&lt;/span&gt;];&lt;br /&gt;     &lt;span style="color: rgb(204, 51, 204);"&gt;break&lt;/span&gt;;&lt;br /&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;case&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;8&lt;/span&gt;:&lt;br /&gt;     &lt;span style="color: rgb(0, 102, 0);"&gt;background&lt;/span&gt;.image = [&lt;span style="color: rgb(51, 0, 153);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"bg8.png"&lt;/span&gt;];&lt;br /&gt;     topLimit = 140;&lt;br /&gt;     &lt;span style="color: rgb(204, 51, 204);"&gt;break&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;}&lt;/blockquote&gt;Easy enough. Later on we can also change parameters like number of enemies or type of enemies etc etc depending on the stage. Cool, huh?&lt;br /&gt;You'll find the backgrounds here:&lt;br /&gt;&lt;br /&gt;Alright, I hope I didn't leave anything out. That should do it for today. Try running around and through all stages and don't forget to shoot here and there to make you look more dangerous.&lt;br /&gt;&lt;br /&gt;PS: I think the editor for the post here might have swollowed some code or something. I did fix one part but incase you find something that looks weird, write a coment&lt;br /&gt;&lt;div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"&gt;&lt;a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/2367861a-271c-44fa-a8a6-82affc4ff5d4/" title="Reblog this post [with Zemanta]"&gt;&lt;img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=2367861a-271c-44fa-a8a6-82affc4ff5d4" alt="Reblog this post [with Zemanta]" /&gt;&lt;/a&gt;&lt;span class="zem-script more-related pretty-attribution"&gt;&lt;script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6060997494574537540-2129983788686585115?l=jcdeveloperworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jcdeveloperworld.blogspot.com/feeds/2129983788686585115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/07/iphone-game-tutorial-part-2.html#comment-form' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/2129983788686585115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/2129983788686585115'/><link rel='alternate' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/07/iphone-game-tutorial-part-2.html' title='iPhone Game Tutorial (Part 2)'/><author><name>JC</name><uri>http://www.blogger.com/profile/17673323321116004458</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_GcGZbzhP2ig/Sh5PAa43UkI/AAAAAAAAAJw/A-uLMPhe994/s1600-R/n606455606_244.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_GcGZbzhP2ig/SnbXCGspLGI/AAAAAAAAAUA/ecKn9YKamUU/s72-c/screenshot.png' height='72' width='72'/><thr:total>17</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6060997494574537540.post-677966803443904438</id><published>2009-07-30T16:53:00.006+02:00</published><updated>2009-07-30T17:18:57.761+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='Game'/><category scheme='http://www.blogger.com/atom/ns#' term='Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Sprites'/><category scheme='http://www.blogger.com/atom/ns#' term='Simple'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone SDK'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone'/><category scheme='http://www.blogger.com/atom/ns#' term='Animation'/><category scheme='http://www.blogger.com/atom/ns#' term='Smartphones'/><category scheme='http://www.blogger.com/atom/ns#' term='Animate'/><title type='text'>iPhone Game Tutorial (Part 1)</title><content type='html'>I thought I could share my methods on how I animate and move stuff around on the iPhone for games with you.&lt;br /&gt;As always, these are just my ways of doing it. I'm sure there are better ways but I'm also very sure that there are far worse ways as well.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://picasaweb.google.de/lh/photo/nQ6LRmg4Gmz-AwBailywzQ?feat=embedwebsite"&gt;&lt;img src="http://lh3.ggpht.com/_GcGZbzhP2ig/SnG5hWFg0zI/AAAAAAAAATQ/xTiA5zGpkx8/s800/screenshot.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;First comes first:&lt;/span&gt;&lt;br /&gt;What do we want to make this app do ?&lt;br /&gt;As a starter I thought it would be cool having a little man being able to run across the screen in an animated fashion.&lt;br /&gt;You'll need the sprites and the background so it looks nicer.&lt;br /&gt;&lt;br /&gt;&lt;table style="width: 194px;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="background: transparent url(http://picasaweb.google.de/s/c/transparent_album_background.gif) no-repeat scroll left center; height: 194px; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;" align="center"&gt;&lt;a href="http://picasaweb.google.de/courtois.j/Sprites?feat=embedwebsite"&gt;&lt;img src="http://lh5.ggpht.com/_GcGZbzhP2ig/SnGj5WS72pE/AAAAAAAAASk/QGqKwnZpmGw/s160-c/Sprites.jpg" style="margin: 1px 0pt 0pt 4px;" height="160" width="160" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="text-align: center; font-family: arial,sans-serif; font-size: 11px;"&gt;&lt;a href="http://picasaweb.google.de/courtois.j/Sprites?feat=embedwebsite" style="color: rgb(77, 77, 77); font-weight: bold; text-decoration: none;"&gt;Sprites&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Once downloaded we can move on.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Create the Project:&lt;/span&gt;&lt;br /&gt;Easy enough. Create a View Based Application. Give it a name and move to the viewController.h.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;ViewController.h:&lt;/span&gt;&lt;br /&gt;We will need to add a few things here.&lt;br /&gt;Our project is going to need a UIImageView to display our little soldier.&lt;br /&gt;We are also going to need an array to hold our images for the walking animation.&lt;br /&gt;For the movement I like using a timer, so we'll create that too.&lt;br /&gt;&lt;br /&gt;As for the functions, we're going to use a button to make the little guy walk across the screen of our iPhone.&lt;br /&gt;So we'll create two functions for that. The name explains itself, right?&lt;br /&gt;The other two void functions will be used by the timer.&lt;br /&gt;&lt;blockquote&gt;&lt;uikit h=""&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;@interface&lt;/span&gt; AnimateViewController : UIViewController {&lt;br /&gt;  &lt;span style="color: rgb(0, 0, 153);"&gt;UIImageView&lt;/span&gt;    *&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;;&lt;br /&gt;  &lt;span style="color: rgb(0, 0, 153);"&gt;NSArray&lt;/span&gt;        *&lt;span style="color: rgb(0, 102, 0);"&gt;walkImages&lt;/span&gt;;&lt;br /&gt;  &lt;span style="color: rgb(0, 0, 153);"&gt;NSTimer&lt;/span&gt;        *&lt;span style="color: rgb(0, 102, 0);"&gt;walkingTimer&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)walk;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)stopWalking;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)startMovingForward;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)moveForward;&lt;/uikit&gt;&lt;/blockquote&gt;&lt;uikit h=""&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Moving on the ViewController.m:&lt;/span&gt;&lt;br /&gt;First we're going to create our little world for the little guy to walk around on.&lt;br /&gt;&lt;br /&gt;Make the application load in Landscape mode&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;- (&lt;span style="color: rgb(204, 51, 204);"&gt;BOOL&lt;/span&gt;)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {&lt;br /&gt;  &lt;span style="color: rgb(204, 51, 204);"&gt;return&lt;/span&gt; (interfaceOrientation == &lt;span style="color: rgb(0, 0, 153);"&gt;UIInterfaceOrientationLandscapeLeft&lt;/span&gt;);&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Interface Builder:&lt;/span&gt;&lt;br /&gt;Now open the ViewController.xib and click on the gray arrow in the top corner of the view. This will make the view rotate into landscape. Add a UIImageView, have it take the whole screen and display "wof028.png" in it and set the mode to aspect fit.&lt;br /&gt;Don't forget to add a UIButton in the top right corner to make the soldier walk.&lt;br /&gt;Go to the Button Connections and assign the function "Walk" to "Touch Down" and "StopWalking" to "Touch Up Inside".&lt;br /&gt;Save and close the Interface Builder.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Back to .m:&lt;/span&gt;&lt;br /&gt;Insert the following in the viewDidLoad:&lt;br /&gt;&lt;blockquote&gt;- (&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)viewDidLoad {&lt;br /&gt;  [&lt;span style="color: rgb(204, 51, 204);"&gt;super&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;viewDidLoad&lt;/span&gt;];&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: rgb(0, 102, 0);"&gt;walkImages&lt;/span&gt; = [[&lt;span style="color: rgb(102, 0, 204);"&gt;NSArray&lt;/span&gt; alloc] &lt;span style="color: rgb(0, 0, 153);"&gt;initWithObjects&lt;/span&gt;:&lt;br /&gt;                         [&lt;span style="color: rgb(102, 0, 204);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"w1.png"&lt;/span&gt;], [&lt;span style="color: rgb(102, 0, 204);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"w2.png"&lt;/span&gt;],&lt;br /&gt;                         [&lt;span style="color: rgb(102, 0, 204);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"w3.png"&lt;/span&gt;], [&lt;span style="color: rgb(102, 0, 204);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"w4.png"&lt;/span&gt;],&lt;br /&gt;                         [&lt;span style="color: rgb(102, 0, 204);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"w5.png"&lt;/span&gt;], [&lt;span style="color: rgb(102, 0, 204);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"w6.png"&lt;/span&gt;], &lt;span style="color: rgb(204, 51, 204);"&gt;nil&lt;/span&gt;];&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt; = [[&lt;span style="color: rgb(102, 0, 204);"&gt;UIImageView&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;alloc&lt;/span&gt;] &lt;span style="color: rgb(0, 0, 153);"&gt;initWithFrame&lt;/span&gt;:&lt;span style="color: rgb(102, 0, 204);"&gt;CGRectMake&lt;/span&gt;(&lt;span style="color: rgb(51, 51, 255);"&gt;100&lt;/span&gt;, &lt;span style="color: rgb(51, 51, 255);"&gt;220&lt;/span&gt;, &lt;span style="color: rgb(51, 51, 255);"&gt;30&lt;/span&gt;, &lt;span style="color: rgb(51, 51, 255);"&gt;30&lt;/span&gt;)];&lt;br /&gt;  &lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.image = [&lt;span style="color: rgb(102, 0, 204);"&gt;UIImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;imageNamed&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"stand.png"&lt;/span&gt;];&lt;br /&gt;  &lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.animationDuration = &lt;span style="color: rgb(51, 51, 255);"&gt;1.5&lt;/span&gt;;&lt;br /&gt;  &lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.contentMode = &lt;span style="color: rgb(0, 0, 153);"&gt;UIViewContentModeBottomLeft&lt;/span&gt;;&lt;br /&gt;  [&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt;.view addSubview:&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;];&lt;br /&gt;&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;Here we simply assigned the images to the array. We could do it with a loop too (which is recommendable if you have more than just a few files) but for this example I wanted to show it like this to make it clearer.&lt;br /&gt;&lt;br /&gt;We also initiate our ImageView "player" with a frame (CGRect). A frame is just that. A frame that holds the position of our image. Much like a picture frame in real life. If you don't understand the numbers of CGRectMake try altering them and see what happens.&lt;br /&gt;We also assign a standard "standing" pose with the "stand.png" to the player.&lt;br /&gt;&lt;br /&gt;The animation duration number is the number of seconds it need to cycle through the whole animation. You'll need to try and see what works good for you. For this example I use 1.5.&lt;br /&gt;&lt;br /&gt;The ContentMode sets where the images will be placed every time in the frame. This is important when the sprites are of different sizes. In our case, not so much.&lt;br /&gt;&lt;br /&gt;Last, we add the image to our view.&lt;br /&gt;&lt;br /&gt;Taking care of the rest:&lt;br /&gt;Add the following:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(102, 51, 0);"&gt;#pragma mark -&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 0);"&gt;#pragma mark IB Actions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)walk {&lt;br /&gt;  [&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt; &lt;span style="color: rgb(51, 102, 102);"&gt;startMovingForward&lt;/span&gt;];&lt;br /&gt;  &lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.animationImages = &lt;span style="color: rgb(0, 102, 0);"&gt;walkImages&lt;/span&gt;;&lt;br /&gt;  [&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;startAnimating&lt;/span&gt;];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)stopWalking {&lt;br /&gt;  [&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;stopAnimating&lt;/span&gt;];&lt;br /&gt;  [&lt;span style="color: rgb(0, 102, 0);"&gt;walkingTimer&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;invalidate&lt;/span&gt;];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 0);"&gt;#pragma mark Move it&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)startMovingForward {&lt;br /&gt;  &lt;span style="color: rgb(0, 102, 0);"&gt;walkingTimer&lt;/span&gt; = [&lt;span style="color: rgb(102, 0, 204);"&gt;NSTimer&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;scheduledTimerWithTimeInterval&lt;/span&gt;:&lt;span style="color: rgb(51, 51, 255);"&gt;0.125&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;target&lt;/span&gt;:&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;selector&lt;/span&gt;:&lt;span style="color: rgb(204, 51, 204);"&gt;@selector&lt;/span&gt;(&lt;span style="color: rgb(0, 102, 0);"&gt;moveForward&lt;/span&gt;) &lt;span style="color: rgb(0, 0, 153);"&gt;userInfo&lt;/span&gt;:&lt;span style="color: rgb(204, 51, 204);"&gt;nil&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;repeats&lt;/span&gt;:&lt;span style="color: rgb(204, 51, 204);"&gt;YES&lt;/span&gt;];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)moveForward {&lt;br /&gt;  &lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.frame = &lt;span style="color: rgb(0, 0, 153);"&gt;CGRectMake&lt;/span&gt;(((&lt;span style="color: rgb(0, 102, 0);"&gt;player&lt;/span&gt;.frame.&lt;span style="color: rgb(102, 0, 204);"&gt;origin&lt;/span&gt;.&lt;span style="color: rgb(102, 0, 204);"&gt;x&lt;/span&gt;)+&lt;span style="color: rgb(51, 51, 255);"&gt;5&lt;/span&gt;), &lt;span style="color: rgb(51, 51, 255);"&gt;220&lt;/span&gt;, &lt;span style="color: rgb(51, 51, 255);"&gt;30&lt;/span&gt;, &lt;span style="color: rgb(51, 51, 255);"&gt;30&lt;/span&gt;);&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Pragma Mark ??&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Pragma Mark can help you organize your code for when it gets very long. Copy the code above and then click on the two arrows pointing up and down at the top back above your code. This will open an index of your methods and the pragma mark text will help you find what you need.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When we tap on the button we'll start the "walk" function. The walk function starts the "moveForward" function, assigns the array walkImages to the property animationImages of our player ImageView and tells the program to start Animating "player".&lt;br /&gt;&lt;br /&gt;startMovingForward will just start the timer. We give it an interval to work with and in the selector we tell it to activate "moveForward" on every interval. Don't forget to tell the timer to repeat itself.&lt;br /&gt;&lt;br /&gt;moveForward will finally take care of the actual moving of the little soldier. We assign a new frame to player which is the same as the current one but we add 5 pixel to its x axis.&lt;br /&gt;&lt;br /&gt;When we lift our finger from the Walking button, the animation and the timer will be stopped.&lt;br /&gt;&lt;br /&gt;Build and run the application. See how it goes.&lt;br /&gt;&lt;/uikit&gt;  &lt;div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"&gt;&lt;a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/a5acc6a4-2a73-4224-9baf-44afc6f03b6e/" title="Reblog this post [with Zemanta]"&gt;&lt;img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=a5acc6a4-2a73-4224-9baf-44afc6f03b6e" alt="Reblog this post [with Zemanta]" /&gt;&lt;/a&gt;&lt;span class="zem-script more-related pretty-attribution"&gt;&lt;script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6060997494574537540-677966803443904438?l=jcdeveloperworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jcdeveloperworld.blogspot.com/feeds/677966803443904438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/07/iphone-game-tutorial-part-1.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/677966803443904438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/677966803443904438'/><link rel='alternate' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/07/iphone-game-tutorial-part-1.html' title='iPhone Game Tutorial (Part 1)'/><author><name>JC</name><uri>http://www.blogger.com/profile/17673323321116004458</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_GcGZbzhP2ig/Sh5PAa43UkI/AAAAAAAAAJw/A-uLMPhe994/s1600-R/n606455606_244.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_GcGZbzhP2ig/SnG5hWFg0zI/AAAAAAAAATQ/xTiA5zGpkx8/s72-c/screenshot.png' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6060997494574537540.post-8580795136122212716</id><published>2009-07-01T14:22:00.005+02:00</published><updated>2009-07-01T15:01:00.076+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Objective C'/><category scheme='http://www.blogger.com/atom/ns#' term='Tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone SDK'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone 3.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Quartz'/><category scheme='http://www.blogger.com/atom/ns#' term='Quartz 2D'/><category scheme='http://www.blogger.com/atom/ns#' term='CGContext'/><category scheme='http://www.blogger.com/atom/ns#' term='Quartz Core'/><title type='text'>[iPhone] Quartz 2D</title><content type='html'>&lt;p class="zemanta-img" style="margin: 1em; float: right; display: block; width: 310px;"&gt;&lt;a href="http://en.wikipedia.org/wiki/Image:Quartz_Composer_Icon.png"&gt;&lt;img src="http://upload.wikimedia.org/wikipedia/en/thumb/7/7a/Quartz_Composer_Icon.png/300px-Quartz_Composer_Icon.png" alt="Quartz Composer" style="border: medium none ; display: block;" height="300" width="300" /&gt;&lt;/a&gt;&lt;span class="zemanta-img-attribution"&gt;Image via &lt;a href="http://en.wikipedia.org/wiki/Image:Quartz_Composer_Icon.png"&gt;Wikipedia&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;The last week I've been fighting to get some stuff working in Quartz. Actually I've been trying to get Quartz itself to work.&lt;br /&gt;I've now managed and thought I could share:&lt;br /&gt;&lt;br /&gt;Open your viewController.xib and add a view inside your view. Size it and move it the way you want it. This is the view that you will use like a tv screen, showing all your Quartz drawing.&lt;br /&gt;(This is the way I am doing it for a specific app. I'm sure you'll find your way that fits your app the most.)&lt;br /&gt;&lt;br /&gt;Select the view and press &lt;span class="Unicode"&gt;&lt;span style="font-style: italic;"&gt;⌘4&lt;/span&gt; and change the class to, lets say, "&lt;span style="font-style: italic;"&gt;QuartzView&lt;/span&gt;".&lt;br /&gt;Select &lt;span style="font-style: italic;"&gt;File&gt;Write Class File&lt;/span&gt; and check the box to create the .h file too.&lt;br /&gt;&lt;br /&gt;Once created, the files will be in your project.&lt;br /&gt;in the QuartzView.h:&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;@interface&lt;/span&gt; QuartzView : UIView {&lt;br /&gt;  &lt;span style="color: rgb(102, 0, 204);"&gt;UIColor&lt;/span&gt;    *&lt;span style="color: rgb(0, 153, 0);"&gt;color&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;@end&lt;/span&gt;&lt;/blockquote&gt;Switch over to the .m file.&lt;br /&gt;The drawRect method is the one where we'll do all the drawing. The drawing code has to be in this method as far as I know.&lt;br /&gt;&lt;br /&gt;Lets start filling in some code in the drawRect method then and try to draw a line.&lt;br /&gt;First, we set the color for our line and retrieve the context. The context is like your canvas where you'll be drawing. All the drawing is done in a context. As we'll only have one context, I'll call it (who would have guessed) "context" :&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;color&lt;/span&gt; = [&lt;span style="color: rgb(102, 0, 204);"&gt;UIColor&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;redColor&lt;/span&gt;];&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;CGContextRef&lt;/span&gt; context = &lt;span style="color: rgb(0, 0, 153);"&gt;UIGraphicsGetCurrentContext&lt;/span&gt;();&lt;/blockquote&gt;&lt;br /&gt;Then, we set some properties of the line we're going to draw. They are pretty self explanatory. You always define the context (which we cleverly called "context") and the specific attribute of the property.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;CGContextSetLineWidth&lt;/span&gt;(context, &lt;span style="color: rgb(51, 51, 255);"&gt;2.0&lt;/span&gt;); &lt;span style="color: rgb(0, 153, 0);"&gt;// We set a 2px thick line.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;CGContextSetStrokeColorWithColor&lt;/span&gt;(context, &lt;span style="color: rgb(0, 102, 0);"&gt;color&lt;/span&gt;.CGColor);&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;CGContextSetFillColorWithColor&lt;/span&gt;(context, &lt;span style="color: rgb(0, 102, 0);"&gt;color&lt;/span&gt;.CGColor);&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;//This settings want a CGColor and not a UIColor. Good for us, UIColor has a property that returns the color as a CGColor.&lt;/span&gt;&lt;/blockquote&gt;Now that we've set the properties of the line we're about to draw, lets prepare the actual movement required to draw a line.&lt;br /&gt;&lt;br /&gt;We'll create 2 CGPoints which basically just group an X &amp;amp; Y coordinate of the screen in one variable.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;CGPoint&lt;/span&gt; startingPoint = CGPointMake(&lt;span style="color: rgb(51, 51, 255);"&gt;20.0&lt;/span&gt;, &lt;span style="color: rgb(51, 51, 255);"&gt;20.0&lt;/span&gt;);&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;CGPoint&lt;/span&gt; finishingPoint = CGPointMake(&lt;span style="color: rgb(51, 51, 255);"&gt;80.0&lt;/span&gt;, &lt;span style="color: rgb(51, 51, 255);"&gt;80.0&lt;/span&gt;);&lt;/blockquote&gt;&lt;br /&gt;Now, we move our virtual drawing hand (with the pencil we've defined earlier) to the starting point and then make it move to the finishing point. We then just have to say to actually draw that line and to update our view. 4 lines of code.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;CGContextMoveToPoint&lt;/span&gt;(context, startingPoint.&lt;span style="color: rgb(102, 0, 204);"&gt;x&lt;/span&gt;, startingPoint.&lt;span style="color: rgb(102, 0, 204);"&gt;y&lt;/span&gt;);&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;CGContextAddLineToPoint&lt;/span&gt;(context, finishingPoint.&lt;span style="color: rgb(102, 0, 204);"&gt;x&lt;/span&gt;, finishingPoint.&lt;span style="color: rgb(102, 0, 204);"&gt;y&lt;/span&gt;);&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;CGContextStrokePath&lt;/span&gt;(context);&lt;br /&gt;[&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;setNeedsDisplay&lt;/span&gt;];&lt;/blockquote&gt;Right, so that's the basics. I'll probably go into more details once I've figured it out better myself soon.&lt;br /&gt;&lt;/span&gt;    &lt;div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"&gt;&lt;a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/437c6243-4667-43c6-846d-68bfc477e257/" title="Reblog this post [with Zemanta]"&gt;&lt;img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=437c6243-4667-43c6-846d-68bfc477e257" alt="Reblog this post [with Zemanta]" /&gt;&lt;/a&gt;&lt;span class="zem-script more-related pretty-attribution"&gt;&lt;script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6060997494574537540-8580795136122212716?l=jcdeveloperworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jcdeveloperworld.blogspot.com/feeds/8580795136122212716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/07/iphone-quartz-2d.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/8580795136122212716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/8580795136122212716'/><link rel='alternate' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/07/iphone-quartz-2d.html' title='[iPhone] Quartz 2D'/><author><name>JC</name><uri>http://www.blogger.com/profile/17673323321116004458</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_GcGZbzhP2ig/Sh5PAa43UkI/AAAAAAAAAJw/A-uLMPhe994/s1600-R/n606455606_244.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6060997494574537540.post-3079680062818558589</id><published>2009-06-22T13:45:00.023+02:00</published><updated>2009-06-25T15:42:07.540+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Objective C'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone Memory'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone SDK'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone'/><category scheme='http://www.blogger.com/atom/ns#' term='Save Data'/><category scheme='http://www.blogger.com/atom/ns#' term='Memory'/><category scheme='http://www.blogger.com/atom/ns#' term='Handhelds'/><category scheme='http://www.blogger.com/atom/ns#' term='Xcode'/><category scheme='http://www.blogger.com/atom/ns#' term='Save'/><category scheme='http://www.blogger.com/atom/ns#' term='Apple'/><title type='text'>[iPhone] Saving Simple Data</title><content type='html'>&lt;p class="zemanta-img" style="margin: 1em; float: right; display: block; width: 250px;"&gt;&lt;a href="http://www.flickr.com/photos/44124466908@N01/1398846596"&gt;&lt;img src="http://farm2.static.flickr.com/1379/1398846596_f85d7e7dbe_m.jpg" alt="My hacked (for apps) iPhone &amp;amp; an iPod Touch at..." style="border: medium none ; display: block;" height="160" width="240" /&gt;&lt;/a&gt;&lt;span class="zemanta-img-attribution"&gt;Image by &lt;a href="http://www.flickr.com/photos/44124466908@N01/1398846596"&gt;Steve Rhodes&lt;/a&gt; via Flickr&lt;/span&gt;&lt;/p&gt;This tutorial will show you an easy way of saving simple bits of data so that they can be continue to be used next time the app is started on your iPhone.&lt;br /&gt;&lt;br /&gt;Imagine you wanted to save some user settings. In this example I have a UISlider and a UISegmentedControler which I want the user to be able to set, but the iPhone should remember the settings and display them in their last state whenever the iPhone App is restarted.&lt;br /&gt;&lt;br /&gt;In the .h file add:&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;float&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0);"&gt;sliderValue&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;float&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0);"&gt;segmentValue&lt;/span&gt;;   &lt;span style="color: rgb(0, 153, 0);"&gt;// Use these values to adjust your UI Elements&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;// You will also need the following methods:&lt;/span&gt;&lt;br /&gt;-(&lt;span style="color: rgb(102, 0, 204);"&gt;NSString&lt;/span&gt; *)dataFilePath;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)applicationWillTerminate:(&lt;span style="color: rgb(102, 0, 204);"&gt;NSNotification&lt;/span&gt; *)notification;&lt;/blockquote&gt;&lt;br /&gt;In the .m file add:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)viewDidLoad&lt;br /&gt;{&lt;br /&gt; &lt;span style="color: rgb(102, 0, 204);"&gt;NSString&lt;/span&gt; *filePath = [&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0);"&gt;dataFilePath&lt;/span&gt;];&lt;br /&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;if&lt;/span&gt;([[&lt;span style="color: rgb(102, 0, 204);"&gt;NSFileManager&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;defaultManager&lt;/span&gt;] &lt;span style="color: rgb(0, 0, 153);"&gt;fileExistsAtPath&lt;/span&gt;:filePath])&lt;br /&gt; {&lt;br /&gt;     &lt;span style="color: rgb(102, 0, 204);"&gt;NSArray&lt;/span&gt; *array = [[&lt;span style="color: rgb(102, 0, 204);"&gt;NSArray&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;alloc&lt;/span&gt;] &lt;span style="color: rgb(0, 0, 153);"&gt;initWithContentsOfFile&lt;/span&gt;:filePath];&lt;br /&gt;     &lt;span style="color: rgb(0, 102, 0);"&gt;sliderValue&lt;/span&gt; = [[array &lt;span style="color: rgb(0, 0, 153);"&gt;objectAtIndex&lt;/span&gt;:&lt;span style="color: rgb(51, 51, 255);"&gt;0&lt;/span&gt;] floatValue];&lt;br /&gt;     &lt;span style="color: rgb(0, 102, 0);"&gt;segmentValue&lt;/span&gt; = [[array &lt;span style="color: rgb(0, 0, 153);"&gt;objectAtIndex&lt;/span&gt;:&lt;span style="color: rgb(51, 51, 255);"&gt;1&lt;/span&gt;] floatValue];&lt;br /&gt;     [array &lt;span style="color: rgb(0, 0, 153);"&gt;release&lt;/span&gt;];&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 204);"&gt;UIApplication&lt;/span&gt; *&lt;span style="color: rgb(0, 102, 0);"&gt;app&lt;/span&gt; = [&lt;span style="color: rgb(102, 0, 204);"&gt;UIApplication&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;sharedApplication&lt;/span&gt;];&lt;br /&gt; [[&lt;span style="color: rgb(0, 0, 153);"&gt;NSNotificationCenter&lt;/span&gt; defaultCenter] &lt;span style="color: rgb(0, 0, 153);"&gt;addObserver&lt;/span&gt;:&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;selector&lt;/span&gt;:&lt;span style="color: rgb(204, 51, 204);"&gt;@selector&lt;/span&gt;(applicationWillTerminate:) &lt;span style="color: rgb(0, 0, 153);"&gt;name&lt;/span&gt;:UIApplicationWillTerminateNotification &lt;span style="color: rgb(0, 0, 153);"&gt;object&lt;/span&gt;:&lt;span style="color: rgb(0, 102, 0);"&gt;app&lt;/span&gt;];&lt;br /&gt; [&lt;span style="color: rgb(204, 51, 204);"&gt;super&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;viewDidLoad&lt;/span&gt;];&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;Above: This is where we load the date if there is any from the last save on the iPhone. First, we check to see if the data file does already exist. If it doesn't, then we don't bother about it. If it does however, we instantiate an array with the contents of the file and add the content to our variable as a float. Remember to save and load them in the same order so you don't mix things up. After having done that, we add some extra code to subscribe to the Notification so that it calls the saving process before quiting the app.&lt;br /&gt;&lt;blockquote&gt;-(&lt;span style="color: rgb(102, 0, 204);"&gt;NSString&lt;/span&gt; *)dataFilePath&lt;br /&gt;{&lt;br /&gt; &lt;span style="color: rgb(102, 0, 204);"&gt;NSArray&lt;/span&gt; *paths = &lt;span style="color: rgb(0, 0, 153);"&gt;NSSearchPathForDirectoriesInDomains&lt;/span&gt;(&lt;span style="color: rgb(0, 0, 153);"&gt;NSDocumentDirectory&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 153);"&gt;NSUserDomainMask&lt;/span&gt;, &lt;span style="color: rgb(204, 51, 204);"&gt;YES&lt;/span&gt;);&lt;br /&gt; &lt;span style="color: rgb(102, 0, 204);"&gt;NSString&lt;/span&gt; *documentsDirectory = [paths &lt;span style="color: rgb(0, 0, 153);"&gt;objectAtIndex&lt;/span&gt;:&lt;span style="color: rgb(51, 51, 255);"&gt;0&lt;/span&gt;];&lt;br /&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;return&lt;/span&gt; [documentsDirectory &lt;span style="color: rgb(0, 0, 153);"&gt;stringByAppendingPathComponent&lt;/span&gt;:&lt;span style="color: rgb(204, 0, 0);"&gt;@"data.plist"&lt;/span&gt;];&lt;br /&gt;}&lt;/blockquote&gt;Above: What this method does is return the full path of the the data file (data.plist). It does that by finding the documents directory on the iPhone/iPod Touch device and appending (adding) "data.plist"&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)applicationWillTerminate:(&lt;span style="color: rgb(102, 0, 204);"&gt;NSNotification&lt;/span&gt; *)notification&lt;br /&gt;{&lt;br /&gt; &lt;span style="color: rgb(102, 0, 204);"&gt;NSMutableArray&lt;/span&gt; *array = [[&lt;span style="color: rgb(102, 0, 204);"&gt;NSMutableArray&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;alloc&lt;/span&gt;] &lt;span style="color: rgb(204, 51, 204);"&gt;init&lt;/span&gt;];&lt;br /&gt; [array &lt;span style="color: rgb(0, 0, 153);"&gt;addObject&lt;/span&gt;: [&lt;span style="color: rgb(102, 0, 204);"&gt;NSNumber&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;numberWithFloat&lt;/span&gt;:&lt;span style="color: rgb(0, 102, 0);"&gt;sliderValue&lt;/span&gt;]];&lt;br /&gt; [array &lt;span style="color: rgb(0, 0, 153);"&gt;addObject&lt;/span&gt;: [&lt;span style="color: rgb(102, 0, 204);"&gt;NSNumber&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;numberWithFloat&lt;/span&gt;:&lt;span style="color: rgb(0, 102, 0);"&gt;segmentValue&lt;/span&gt;]];&lt;br /&gt; [array &lt;span style="color: rgb(0, 0, 153);"&gt;writeToFile&lt;/span&gt;:[&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0);"&gt;dataFilePath&lt;/span&gt;] &lt;span style="color: rgb(0, 0, 153);"&gt;atomically&lt;/span&gt;: &lt;span style="color: rgb(204, 51, 204);"&gt;YES&lt;/span&gt;];&lt;br /&gt; [array &lt;span style="color: rgb(0, 0, 153);"&gt;release&lt;/span&gt;];&lt;br /&gt;}&lt;/blockquote&gt;Above: The method will be called when, as you might have guessed, the application will get terminated/closed. Here is where you should add all the data you want to keep for the next time the iPhone loads the Application.&lt;br /&gt;   &lt;div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"&gt;&lt;a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/66122f31-7c97-4b03-aa2a-e36c1ad7738f/" title="Reblog this post [with Zemanta]"&gt;&lt;img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=66122f31-7c97-4b03-aa2a-e36c1ad7738f" alt="Reblog this post [with Zemanta]" /&gt;&lt;/a&gt;&lt;span class="zem-script more-related pretty-attribution"&gt;&lt;script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6060997494574537540-3079680062818558589?l=jcdeveloperworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jcdeveloperworld.blogspot.com/feeds/3079680062818558589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/06/iphone-saving-simple-data.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/3079680062818558589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/3079680062818558589'/><link rel='alternate' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/06/iphone-saving-simple-data.html' title='[iPhone] Saving Simple Data'/><author><name>JC</name><uri>http://www.blogger.com/profile/17673323321116004458</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_GcGZbzhP2ig/Sh5PAa43UkI/AAAAAAAAAJw/A-uLMPhe994/s1600-R/n606455606_244.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm2.static.flickr.com/1379/1398846596_f85d7e7dbe_t.jpg' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6060997494574537540.post-5648822519568408477</id><published>2009-06-18T13:24:00.009+02:00</published><updated>2009-06-18T14:01:13.088+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Objective C'/><category scheme='http://www.blogger.com/atom/ns#' term='Button'/><category scheme='http://www.blogger.com/atom/ns#' term='Interface Builder'/><category scheme='http://www.blogger.com/atom/ns#' term='Resign First Responder'/><category scheme='http://www.blogger.com/atom/ns#' term='keyboard'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone SDK'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone'/><category scheme='http://www.blogger.com/atom/ns#' term='disapear'/><category scheme='http://www.blogger.com/atom/ns#' term='Xcode'/><category scheme='http://www.blogger.com/atom/ns#' term='done editing'/><category scheme='http://www.blogger.com/atom/ns#' term='Apple'/><title type='text'>[iPhone] Removing the Keyboard when done.</title><content type='html'>&lt;p class="zemanta-img" style="margin: 1em; float: right; display: block; width: 250px;"&gt;&lt;a href="http://www.flickr.com/photos/66587853@N00/2806385836"&gt;&lt;img src="http://farm4.static.flickr.com/3086/2806385836_9b0356c98f_m.jpg" alt="iphone keyboard" style="border: medium none ; display: block;" height="180" width="240" /&gt;&lt;/a&gt;&lt;span class="zemanta-img-attribution"&gt;Image by &lt;a href="http://www.flickr.com/photos/66587853@N00/2806385836"&gt;_snapp&lt;/a&gt; via Flickr&lt;/span&gt;&lt;/p&gt;Let me continue with the easy stuff to fill up the Blog a little more.&lt;br /&gt;Today I'll go through how to make the keyboard move out of the way once you are done editing the field.&lt;br /&gt;&lt;br /&gt;There are two basic ways of doing it. One, is pressing the DONE key on the keyboard. The other way is tapping with your finger anywhere else on the screen.&lt;br /&gt;&lt;br /&gt;Lets clarify:&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;UITextField&lt;/span&gt; *&lt;span style="color: rgb(0, 102, 0);"&gt;myTextField&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;UITextField&lt;/span&gt; *&lt;span style="color: rgb(0, 102, 0);"&gt;myOtherTextField&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)backgroundClick:(&lt;span style="color: rgb(204, 51, 204);"&gt;id&lt;/span&gt;)sender;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)doneEditing:(&lt;span style="color: rgb(204, 51, 204);"&gt;id&lt;/span&gt;)sender;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Using the DONE key:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To make it return with the Done key start by adding the following code:&lt;br /&gt;&lt;blockquote&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)doneEditing:(&lt;span style="color: rgb(204, 51, 204);"&gt;id&lt;/span&gt;)sender&lt;br /&gt;{&lt;br /&gt;       [sender &lt;span style="color: rgb(0, 0, 153);"&gt;resignFirstResponder&lt;/span&gt;];&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;Any controller can be called to resign the First Responder status. With this simple function done lets set WHEN it will be called.&lt;br /&gt;Open Interface Builder and single click on one of the Text Fields and click &lt;span class="mw-headline"&gt;&lt;span class="Unicode"&gt;&lt;span style="font-weight: bold;"&gt;⌘2&lt;/span&gt; to open up the connections inspector.&lt;br /&gt;&lt;br /&gt;Connect the &lt;span style="font-style: italic;"&gt;Did End on Exit&lt;/span&gt; event with the &lt;span style="font-style: italic;"&gt;doneEditing&lt;/span&gt; function by dragging the little circle symbol next to the event name to the File's Owner.&lt;br /&gt;&lt;br /&gt;Repeat this for the other text field to show that you don't need a separate function for every field and try it out.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;By tapping it away:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Some keyboard layouts don't have a DONE key. Or even if they have, a lot of people prefere to just tapp it away instead of tapping the small button in the corner. For these situations there is a quick and easy way of solving the problem.&lt;br /&gt;&lt;br /&gt;Add the following code:&lt;br /&gt;&lt;blockquote&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)backgroundClick:(&lt;span style="color: rgb(204, 51, 204);"&gt;id&lt;/span&gt;)sender&lt;br /&gt;{&lt;br /&gt;       [&lt;span style="color: rgb(0, 102, 0);"&gt;myTextField&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;resignFirstResponder&lt;/span&gt;];&lt;br /&gt;       [&lt;span style="color: rgb(0, 102, 0);"&gt;myOtherTextField&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;resignFirstResponder&lt;/span&gt;];&lt;br /&gt;}&lt;/blockquote&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;br /&gt;Can you already guess?  Lets see.&lt;br /&gt;&lt;br /&gt;Save it again and go back to to Interface Builder.&lt;br /&gt;Drag a &lt;span style="font-style: italic;"&gt;Round Rect Button&lt;/span&gt; over your view and resize it so that it covers ALL of your view.&lt;br /&gt;Now Select &lt;span style="font-weight: bold;"&gt;Layout &gt; Send to Back&lt;/span&gt; and don't deselect the button anymore. The Button is now behind everything else you are showing.&lt;br /&gt;&lt;br /&gt;Press &lt;/span&gt;&lt;/span&gt;&lt;span class="mw-headline"&gt;&lt;span class="Unicode"&gt;&lt;span style="font-weight: bold;"&gt;⌘1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="mw-headline"&gt;&lt;span class="Unicode"&gt; and change the type to &lt;span style="font-style: italic;"&gt;Custom&lt;/span&gt;.&lt;br /&gt;You now have an invisible button in you back layer. Only thing missing now is to connect the &lt;span style="font-style: italic;"&gt;Did touch up inside&lt;/span&gt; event to the action &lt;span style="font-style: italic;"&gt;backgroundClick&lt;/span&gt; and you're done.&lt;br /&gt;&lt;br /&gt;Notice that you can ask all of your fields to resign First Responder even if they don't currently have it and it won't cause any problem.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;      &lt;div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"&gt;&lt;a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/741ef575-7e70-48e2-9a74-07eb0f8eaa0d/" title="Reblog this post [with Zemanta]"&gt;&lt;img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=741ef575-7e70-48e2-9a74-07eb0f8eaa0d" alt="Reblog this post [with Zemanta]" /&gt;&lt;/a&gt;&lt;span class="zem-script more-related pretty-attribution"&gt;&lt;script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6060997494574537540-5648822519568408477?l=jcdeveloperworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jcdeveloperworld.blogspot.com/feeds/5648822519568408477/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/06/image-by-snapp-via-flickr-let-me.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/5648822519568408477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/5648822519568408477'/><link rel='alternate' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/06/image-by-snapp-via-flickr-let-me.html' title='[iPhone] Removing the Keyboard when done.'/><author><name>JC</name><uri>http://www.blogger.com/profile/17673323321116004458</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_GcGZbzhP2ig/Sh5PAa43UkI/AAAAAAAAAJw/A-uLMPhe994/s1600-R/n606455606_244.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3086/2806385836_9b0356c98f_t.jpg' height='72' width='72'/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6060997494574537540.post-2124026957216944611</id><published>2009-06-17T09:49:00.015+02:00</published><updated>2009-06-23T11:08:09.485+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Objective C'/><category scheme='http://www.blogger.com/atom/ns#' term='UIImage'/><category scheme='http://www.blogger.com/atom/ns#' term='Library'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone'/><category scheme='http://www.blogger.com/atom/ns#' term='total training'/><category scheme='http://www.blogger.com/atom/ns#' term='UIImageView'/><category scheme='http://www.blogger.com/atom/ns#' term='Save'/><category scheme='http://www.blogger.com/atom/ns#' term='Guide'/><category scheme='http://www.blogger.com/atom/ns#' term='SDK'/><category scheme='http://www.blogger.com/atom/ns#' term='Window'/><category scheme='http://www.blogger.com/atom/ns#' term='Image file formats'/><category scheme='http://www.blogger.com/atom/ns#' term='Tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='Programmatically'/><category scheme='http://www.blogger.com/atom/ns#' term='Image compression'/><category scheme='http://www.blogger.com/atom/ns#' term='JPEG'/><title type='text'>[iPhone] Saving an Image to the Library from UIImageView</title><content type='html'>&lt;p class="zemanta-img" style="margin: 1em; float: right; display: block; width: 170px;"&gt;&lt;a href="http://www.flickr.com/photos/87622946@N00/1374538423"&gt;&lt;img src="http://farm2.static.flickr.com/1429/1374538423_b023acb1a1_m.jpg" alt="Photo Library" style="border: medium none ; display: block;" height="240" width="160" /&gt;&lt;/a&gt;&lt;span class="zemanta-img-attribution"&gt;Image by &lt;a href="http://www.flickr.com/photos/87622946@N00/1374538423"&gt;ahhyeah&lt;/a&gt; via Flickr&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;/blockquote&gt;In my latest app I have a UIImageView which shows an Image that has been taken from the web.&lt;br /&gt;I then wanted to give the user the possibility to save that shown image to his library.&lt;br /&gt;At this point I was getting ready for some longer coding for this but it turned out to be very easy.&lt;br /&gt;&lt;br /&gt;To start from the same line let me point out where we are:&lt;br /&gt;I have the following:&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;UIImageView&lt;/span&gt; *&lt;span style="color: rgb(0, 102, 0);"&gt;imageView&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;UIImage&lt;/span&gt; *&lt;span style="color: rgb(0, 102, 0);"&gt;myImage&lt;/span&gt;;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)savePicture;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;This is how its done:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;IBAction&lt;/span&gt;)savePicture&lt;br /&gt;{&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;myImage&lt;/span&gt; = &lt;span style="color: rgb(0, 102, 0);"&gt;imageView&lt;/span&gt;.image; &lt;span style="color: rgb(0, 153, 0);"&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;span style="font-style: italic;"&gt;/* I assign the image that is being displayed in imageView to myImage */&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;&lt;br /&gt;UIImageWriteToSavedPhotosAlbum&lt;/span&gt;(&lt;span style="color: rgb(0, 102, 0);"&gt;myImage&lt;/span&gt;, &lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt;, &lt;span style="color: rgb(204, 51, 204);"&gt;@selector&lt;/span&gt;(&lt;span style="color: rgb(0, 102, 0);"&gt;image&lt;/span&gt;:&lt;span style="color: rgb(0, 102, 0);"&gt;didFinishSavingWithError&lt;/span&gt;:&lt;span style="color: rgb(0, 102, 0);"&gt;contextInfo&lt;/span&gt;:), &lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt;); &lt;span style="color: rgb(0, 153, 0);"&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;/* This is the only code needed to save it to the library. See, its easier than you thought. */&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;[&lt;span style="color: rgb(0, 102, 0);"&gt;myImage&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;release&lt;/span&gt;]; &lt;span style="color: rgb(0, 153, 0);"&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;/* Release the image as we don't need to touch that anymore. Always a good thing to release images as early as possible */&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0); font-style: italic;"&gt;//This is the error check to make sure we have a nice handling of our saving process.&lt;/span&gt;&lt;br /&gt;-(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt;)image:(&lt;span style="color: rgb(102, 0, 204);"&gt;UIImage&lt;/span&gt; *)image didFinishSavingWithError:(&lt;span style="color: rgb(102, 0, 204);"&gt;NSError&lt;/span&gt; *)error contextInfo:(&lt;span style="color: rgb(204, 51, 204);"&gt;void&lt;/span&gt; *)contextInfo&lt;br /&gt;{&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0); font-style: italic;"&gt;// Lets create an UIAlertView to display that everything is fine.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0); font-style: italic;"&gt;    // That way the user will know it has been actually saved.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;NSString&lt;/span&gt; *msg = &lt;span style="color: rgb(204, 0, 0);"&gt;@"Saved!!!"&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;UIAlertView&lt;/span&gt; *alert = [[&lt;span style="color: rgb(102, 0, 204);"&gt;UIAlertView&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;alloc&lt;/span&gt;] &lt;span style="color: rgb(0, 0, 153);"&gt;initWithTitle&lt;/span&gt;:&lt;span style="color: rgb(153, 0, 0);"&gt;@"Saved."&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;message&lt;/span&gt;:msg &lt;span style="color: rgb(0, 0, 153);"&gt;delegate&lt;/span&gt;:&lt;span style="color: rgb(204, 51, 204);"&gt;self&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;cancelButtonTitle&lt;/span&gt;:&lt;span style="color: rgb(204, 51, 204);"&gt;nil&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;otherButtonTitles&lt;/span&gt;:&lt;span style="color: rgb(153, 0, 0);"&gt;@"OK"&lt;/span&gt;, &lt;span style="color: rgb(204, 51, 204);"&gt;nil&lt;/span&gt;];&lt;br /&gt;[alert &lt;span style="color: rgb(102, 0, 204);"&gt;show&lt;/span&gt;];&lt;br /&gt;[alert &lt;span style="color: rgb(102, 0, 204);"&gt;release&lt;/span&gt;];&lt;br /&gt;[str &lt;span style="color: rgb(102, 0, 204);"&gt;release&lt;/span&gt;];&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;And that's it.&lt;br /&gt;If you have any questions, I can try helping you out.      &lt;div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"&gt;&lt;a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/3c1eaa0f-6a73-4990-9e12-4410f38b76a1/" title="Reblog this post [with Zemanta]"&gt;&lt;img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=3c1eaa0f-6a73-4990-9e12-4410f38b76a1" alt="Reblog this post [with Zemanta]" /&gt;&lt;/a&gt;&lt;span class="zem-script more-related pretty-attribution"&gt;&lt;script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6060997494574537540-2124026957216944611?l=jcdeveloperworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jcdeveloperworld.blogspot.com/feeds/2124026957216944611/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/06/iphone-saving-image-to-library-from.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/2124026957216944611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/2124026957216944611'/><link rel='alternate' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/06/iphone-saving-image-to-library-from.html' title='[iPhone] Saving an Image to the Library from UIImageView'/><author><name>JC</name><uri>http://www.blogger.com/profile/17673323321116004458</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_GcGZbzhP2ig/Sh5PAa43UkI/AAAAAAAAAJw/A-uLMPhe994/s1600-R/n606455606_244.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm2.static.flickr.com/1429/1374538423_b023acb1a1_t.jpg' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6060997494574537540.post-5042019476684145148</id><published>2009-06-16T12:38:00.003+02:00</published><updated>2009-06-23T11:05:51.528+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Web page'/><category scheme='http://www.blogger.com/atom/ns#' term='iPhone'/><category scheme='http://www.blogger.com/atom/ns#' term='Academia'/><category scheme='http://www.blogger.com/atom/ns#' term='Handhelds'/><category scheme='http://www.blogger.com/atom/ns#' term='Engineering'/><category scheme='http://www.blogger.com/atom/ns#' term='Software Engineering'/><category scheme='http://www.blogger.com/atom/ns#' term='Smartphones'/><category scheme='http://www.blogger.com/atom/ns#' term='Germany'/><category scheme='http://www.blogger.com/atom/ns#' term='Apple'/><title type='text'>What's in this Blog? Whom is it for? How often will there be new content?</title><content type='html'>&lt;p class="zemanta-img" style="margin: 1em; float: right; display: block; width: 170px;"&gt;&lt;a href="http://www.flickr.com/photos/72777325@N00/163652889"&gt;&lt;img src="http://farm1.static.flickr.com/19/163652889_ace929eab6_m.jpg" alt="Hannover Norld-LB Building" style="border: medium none ; display: block;" height="240" width="160" /&gt;&lt;/a&gt;&lt;span class="zemanta-img-attribution"&gt;Image by &lt;a href="http://www.flickr.com/photos/72777325@N00/163652889"&gt;dheuer&lt;/a&gt; via Flickr&lt;/span&gt;&lt;/p&gt;All very good questions in fact and there are the answers:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What's in this Blog?&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;I am a Software Engineer working for a middle size Internet Marketing Company. We do web pages, server hosting, custom applications etc and since currently: iPhone Applications which I am currently assigned to.&lt;br /&gt;&lt;br /&gt;This summer I will be starting a 3 year schooling program in Software Engineering in a unique system in Germany. I will be part working in the company and part learning at a IT&amp;amp;Media Academy. It's not quiet likeStudying at a University as you earn practical experience just as academic.&lt;br /&gt;&lt;br /&gt;So when I'm starting, I will be updating every bit of interesting knowledge on this blog, letting the world take part and learn as much as I am. Be prepared for a lot of info on this page.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Whom is this Blog for?&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;For anybody interested in Development. Not just for Mobile Applications but for everything that has to do with Software Engineering and Internet Marketing.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How often will there be new updates?&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;Often. I can't tell you yet exactly how often and I don't want to give you a fix amount as it depends on the course. But be assured that every time I learn something new or old I will be making a post here for you and myself too.&lt;/blockquote&gt;        &lt;div style="margin-top: 10px; height: 15px;" class="zemanta-pixie"&gt;&lt;a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/df0772b9-10b8-4c59-aad7-b2ff0285b95f/" title="Reblog this post [with Zemanta]"&gt;&lt;img style="border: medium none ; float: right;" class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=df0772b9-10b8-4c59-aad7-b2ff0285b95f" alt="Reblog this post [with Zemanta]" /&gt;&lt;/a&gt;&lt;span class="zem-script more-related pretty-attribution"&gt;&lt;script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6060997494574537540-5042019476684145148?l=jcdeveloperworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jcdeveloperworld.blogspot.com/feeds/5042019476684145148/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/05/whats-in-this-blog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/5042019476684145148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6060997494574537540/posts/default/5042019476684145148'/><link rel='alternate' type='text/html' href='http://jcdeveloperworld.blogspot.com/2009/05/whats-in-this-blog.html' title='What&apos;s in this Blog? Whom is it for? How often will there be new content?'/><author><name>JC</name><uri>http://www.blogger.com/profile/17673323321116004458</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://1.bp.blogspot.com/_GcGZbzhP2ig/Sh5PAa43UkI/AAAAAAAAAJw/A-uLMPhe994/s1600-R/n606455606_244.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm1.static.flickr.com/19/163652889_ace929eab6_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
