<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Raphael Wichmann &#187; Objective-C</title>
	<atom:link href="http://www.rwichmann.com/category/objective-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rwichmann.com</link>
	<description>ActionScript and other computer related stuff.</description>
	<lastBuildDate>Tue, 30 Aug 2011 10:58:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>IntelliDrink released</title>
		<link>http://www.rwichmann.com/2011/08/26/intellidrink-released/</link>
		<comments>http://www.rwichmann.com/2011/08/26/intellidrink-released/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 11:18:17 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://www.rwichmann.com/?p=302</guid>
		<description><![CDATA[My new iPhone app IntelliDrink just hit the Apple AppStore. It is a blood-alcohol content (BAC) calculator which gives you a nice overview about your current BAC and how your BAC is going to rise or drop. Actually there are many apps like that in the store but nevertheless I think IntelliDrink is somehow special. [...]]]></description>
			<content:encoded><![CDATA[<p>My new iPhone app IntelliDrink just hit the Apple AppStore. It is a blood-alcohol content (BAC) calculator which gives you a nice overview about your current BAC and how your BAC is going to rise or drop. Actually there are many apps like that in the store but nevertheless I think IntelliDrink is somehow special.</p>
<p>The main difference is that my goal was not to create a fun app. I wanted to create a serious app which gives you good results. I put a lot of effort into the calculation algorithm which core based on the the scientifically accepted Widmark formula. This formula considers many human characteristics but it does not consider how long you are drinking a drink, how your hungry feeling was when you had the drink and it does not consider how fast your absorption and resorption of alcohol is. Most apps assume that you downed the drink when you entered it. And even worse they assume that you completely digested it which certainly has nothing to do with how it really works.</p>
<p>The algorithm of IntelliDrink takes all of these factors into consideration. It is a complex algorithm which result is visualized on a nice graph. So you can see how your BAC value is rising over time, when your peak is reached and when you are going to be sober again. You can scroll and zoom in the graph too.</p>
<p>Another nice thing is that you can change the drinks you had or even change your profile settings afterwards. The graph is recalculated every time. So removing drinks, changing their sizes or moment of drinking is possible at anytime.</p>
<p>The second difference to other apps is the quality. I wanted to release a really good looking and very usable app. So I put plenty of time in polishing the user interface making it easy to understand and and giving it a valuable feel.</p>
<p>Just have a look for yourself: <a href="http://www.intellidrink.com" title="IntelliDrink" target="_blank">www.intellidrink.com</a><br />
If you like the app, please vote for it!</p>
<p>Cheers,<br />
Raphael <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a href="http://www.intellidrink.com" target="_blank"><img id="contentimage" src="/wp-content/uploads/2011/08/intellidrink-post1.jpg" alt="IntelliDrink" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2011/08/26/intellidrink-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iKicker &#8211; a simple football game</title>
		<link>http://www.rwichmann.com/2010/06/23/ikicker-a-simple-football-game/</link>
		<comments>http://www.rwichmann.com/2010/06/23/ikicker-a-simple-football-game/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 13:08:42 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.rwichmann.com/?p=279</guid>
		<description><![CDATA[I finally developed my first own iPhone app which is now in the App Store. It is a free and simple football game. The game is about about keeping a ball in the air. The more often you hit the ball the harder it gets and the more visual effects motivate you to keep trying. [...]]]></description>
			<content:encoded><![CDATA[<p>I finally developed my first own iPhone app which is now in the App Store. It is a free and simple football game.</p>
<p>The game is about about keeping a ball in the air. The more often you hit the ball the harder it gets and the more visual effects motivate you to keep trying. The audience is also getting louder. If you reach 25 hits the first firework is launching.</p>
<p>The limit is 400 hits. At this score the sensitive area the ball reacts to is not existent anymore. Plus the gravity and the horizontal deflection is increasing. My goal was to have an easy entry for people who are no pro gamers. So the game is very easy if you begin. But it is getting harder an harder. So pro gamers score are not that far away from the beginners which might motivates the beginners trying to get better.</p>
<p>Another nice feature is the feedback you get if you beat your own high score. The app compares your score with the last 1000 submits of other players and tells you which position you reached. The good thing with this approach is that you always have a relative comparison of your score. Even if 100.000 people are playing every day. With a real leaderboard your ranking would decrease with the number of people playing.</p>
<p>After 5 days in the App Store there are now 4500 entries in the database. After one year there are over 600.000 entries in the database.</p>
<p><a href="http://itunes.apple.com/us/app/ikicker-simple-football-game/id376866755?mt=8&#038;uo=4" target="_blank">Download</a> the game and check it out!<br />
If you like the game I would appreciate it very much if you write a short review. Thanks.</p>
<p>Cheers,<br />
Raphael <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a href="http://itunes.apple.com/us/app/ikicker-simple-football-game/id376866755?mt=8&#038;uo=4" target="_blank"><img id="contentimage" src="/wp-content/uploads/2010/06/ikicker_blog_screenshot.jpg" alt="iKicker Screenshots" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2010/06/23/ikicker-a-simple-football-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beginning iPhone Development</title>
		<link>http://www.rwichmann.com/2009/03/05/beginning-iphone-development/</link>
		<comments>http://www.rwichmann.com/2009/03/05/beginning-iphone-development/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 18:22:51 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.rwichmann.com/?p=104</guid>
		<description><![CDATA[The title says what I am doing and it&#8217;s also the title of my current favourite book. I bought two books. One is for diving into Objective-C and the other one is about the iPhone SDK. It worked out to be a good idea having two books. One for Objective-C basics and the other one [...]]]></description>
			<content:encoded><![CDATA[<p>The title says what I am doing and it&#8217;s also the title of my current favourite book.</p>
<p>I bought two books. One is for diving into Objective-C and the other one is about the iPhone SDK. It worked out to be a good idea having two books. One for Objective-C basics and the other one more iPhone specific. Although the iPhone book is my favourite book, you need to have basic knowledge about Objective-C to understand what they are doing there.</p>
<p>This book: <a href="http://www.amazon.com/Beginning-iPhone-Development-Exploring-SDK/dp/1430216263/ref=pd_bbs_sr_1" target="_blank">Beginning iPhone Development</a> is really good. Every chapter contains a Step by Step tutorial on a specific theme. It&#8217;s really fun reading and everything is really easy explained.</p>
<p>The second book called <a href="http://www.amazon.com/Programming-Objective-C-Developers-Library-Stephen/dp/0672325861/ref=sr_1_4" target="_blank">Programming in Objective-C</a> is ok but it&#8217;s nothing special. It&#8217;s not bad though. It&#8217;s just a usual book about a programming language. If you consider buying this book better buy this one: &#8220;Programming in Objective-C 2.0&#8243;. Or a completely different one.</p>
<p>So I started reading the Objective-C book. If you are familiar with ActionScript everything seems different to you. How you declare variables, call functions, handle events and a lot more. Tracing! So simple in ActionScript. And a good example for a comparison:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;myNumber: &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> myNumber<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">NSLog<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> alloc<span style="color: #002200;">&#93;</span><br />
&nbsp; &nbsp; initWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;myNumber: %f&quot;</span>, myNumber<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;</div></div>
<p>What is that?! Some things are really strange. And I&#8217;m not into it that much that I could say: &#8220;Ok, it is a little bit odd but actually it is better because &#8230; &#8220;. So I just accepted it <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Even if it is a little bit painful for me leaving the comfortable ActionScript enviroment it is a lot fun starting with iPhone programming. You simply have access to data you normally don&#8217;t have in ActionScript. Think of things like multitouch, accelerometer, GPS location, access to the adressbook of the user and a lot more.</p>
<p>So I started developing a really simple game. I think it is always good if you set yourself a goal to achieve. My goal is to develop a simple football game. The concept is pretty easy. You kick a ball and have to keep in the air. The longer you keep the ball in the air the higher the score. The score is to be saved in a database later.</p>
<p>I read the iPhone book and Keith Peters <a href="http://www.bit-101.com/blog/?p=1784" target="_blank">tutorial</a> about gravity on the iPhone. And i watched some videos on this site: <a href="http://www.iphonedevcentral.org/" target="_blank">www.iphonedevcentral.org</a>.</p>
<p>This is the current state. Unfortunately it doesn&#8217;t run that smooth on the iPhone. The difference between the X-Code-Simulator and the runtime on the iPhone is pretty big. I guess I should do the movement with openGL. Another language I don&#8217;t know. But the book is already ordered <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Have a look for yourself:</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_videoplayer_1136591107"
			class="flashmovie"
			width="455"
			height="256">
	<param name="movie" value="/swf/videoplayer.swf" />
	<param name="flashvars" value="path=../video/beginningiphone.mp4&#038&amp;normalWidth=455&#038&amp;normalHeight=256&#038&amp;maxWidth=1024&#038&amp;maxHeight=576" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/swf/videoplayer.swf"
			name="fm_videoplayer_1136591107"
			width="455"
			height="256">
		<param name="flashvars" value="path=../video/beginningiphone.mp4&#038&amp;normalWidth=455&#038&amp;normalHeight=256&#038&amp;maxWidth=1024&#038&amp;maxHeight=576" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2009/03/05/beginning-iphone-development/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Custom Events in Objective-C</title>
		<link>http://www.rwichmann.com/2009/03/02/custom-events-in-objective-c/</link>
		<comments>http://www.rwichmann.com/2009/03/02/custom-events-in-objective-c/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 19:59:38 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[notifications]]></category>

		<guid isPermaLink="false">http://www.rwichmann.com/?p=87</guid>
		<description><![CDATA[If you are living in the ActionScript world and you are looking for something like an event handling system, you might won&#8217;t find any. I googled events and custom events, callbacks and finally figured out that they call it &#8220;Notifications&#8221;. Events or in this case Notifications are used for having loosely coupled relationships between instances [...]]]></description>
			<content:encoded><![CDATA[<p>If you are living in the ActionScript world and you are looking for something like an event handling system, you might won&#8217;t find any. I googled events and custom events, callbacks and finally figured out that they call it &#8220;Notifications&#8221;.</p>
<p>Events or in this case Notifications are used for having loosely coupled relationships between instances in your application. So it is possible to let other instances listen to specific events without knowing each other.</p>
<p>If you want to listen to a custom event in ActionScript it would look something like this:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">instance<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;eventType&quot;</span><span style="color: #000066; font-weight: bold;">,</span> eventHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #339966; font-weight: bold;">function</span> eventHandler<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;event triggered&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>In your instance you would trigger the event like this:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Event</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;eventType&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>The Objective-C approach to listen to a Notification looks like this:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSNotificationCenter</span> defaultCenter<span style="color: #002200;">&#93;</span><br />
&nbsp; &nbsp; addObserver<span style="color: #002200;">:</span>self<br />
&nbsp; &nbsp; selector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>eventHandler<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><br />
&nbsp; &nbsp; name<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;eventType&quot;</span><br />
&nbsp; &nbsp; object<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> <span style="color: #002200;">&#93;</span>;<br />
<br />
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>eventHandler<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSNotification</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> notification<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;event triggered&quot;</span><span style="color: #002200;">&#41;</span>;<br />
<span style="color: #002200;">&#125;</span></div></div>
<p>The funny thing is that you don&#8217;t need to put this Event Listener on an instance. It just listens to the eventtype and as far as I understood you can trigger this event wherever you want. This makes it even more loosely coupled than the instance.addEventListener(); approach.</p>
<p>The &#8220;NSNotificationCenter&#8221; is something like a Singleton which is one unique Class that manages your events in your application.</p>
<p>And this is how you dispatch or trigger the event:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSNotificationCenter</span> defaultCenter<span style="color: #002200;">&#93;</span><br />
&nbsp; &nbsp; postNotificationName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;eventType&quot;</span><br />
&nbsp; &nbsp; object<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> <span style="color: #002200;">&#93;</span>;</div></div>
<p>That&#8217;s it. Actually I like the approach in Objective-C even if it is more to write it is pretty easy to read.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2009/03/02/custom-events-in-objective-c/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Objective-C, first steps</title>
		<link>http://www.rwichmann.com/2009/02/08/objective-c-first-steps/</link>
		<comments>http://www.rwichmann.com/2009/02/08/objective-c-first-steps/#comments</comments>
		<pubDate>Sun, 08 Feb 2009 17:14:53 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=34</guid>
		<description><![CDATA[Actually I&#8217;m wondering how many people start coding Objective-C these days. Especially Flash coders. It must be the App-Store that comes with the iPhone making it really easy to publish your applications to millions of people with a minimum of effort. Plus Flash 10 doesn&#8217;t really come with that much new stuff that you don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Actually I&#8217;m wondering how many people start coding Objective-C these days. Especially Flash coders. It must be the App-Store that comes with the iPhone making it really easy to publish your applications to millions of people with a minimum of effort.</p>
<p>Plus Flash 10 doesn&#8217;t really come with that much new stuff that you don&#8217;t need to study every day to keep track with the development. Compared to the times when AS2 was released for example. It&#8217;s not that there is nothing new to learn for me. Especially in the area of Application Frameworks.. I&#8217;m still stuck with Cairngorm which does a good job for me though.</p>
<p>I&#8217;m just interested in some new things. And Objective-C is something pretty new for me. Its a C-Language and the syntax is fairly different from what you know from ActionScript.</p>
<p>The good thing I realized is: If you understood the core concepts of object oriented programming, you can easily learn Objective-C. It&#8217;s more like a different dialect from the same logical language.</p>
<p>Today I wrote my first application. It&#8217;s a really simple calculator but it gives you an impression on how the Objective-C syntax looks like.</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #11740a; font-style: italic;">//</span><br />
<span style="color: #11740a; font-style: italic;">// &nbsp;main.m</span><br />
<span style="color: #11740a; font-style: italic;">// &nbsp;Calculator</span><br />
<span style="color: #11740a; font-style: italic;">//</span><br />
<span style="color: #11740a; font-style: italic;">// &nbsp;Created by Raphael Wichmann on 05.02.09.</span><br />
<span style="color: #11740a; font-style: italic;">// &nbsp;Copyright Raphael Wichmann 2009. All rights reserved.</span><br />
<span style="color: #11740a; font-style: italic;">//</span><br />
<br />
<span style="color: #6e371a;">#import &lt;stdio.h&gt;</span><br />
<span style="color: #6e371a;">#import &lt;objc/Object.h&gt;</span><br />
<br />
<br />
<span style="color: #a61390;">@interface</span> Calculator<span style="color: #002200;">:</span> Object<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #a61390;">int</span> _numbera;<br />
&nbsp; &nbsp; <span style="color: #a61390;">int</span> _numberb;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> print;<br />
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setNumberA<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span> a;<br />
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setNumberB<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span> b;<br />
<br />
<span style="color: #a61390;">@end</span><br />
<br />
<br />
<span style="color: #a61390;">@implementation</span> Calculator<br />
<br />
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> print<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #a61390;">int</span> result <span style="color: #002200;">=</span> _numbera <span style="color: #002200;">+</span> _numberb;<br />
&nbsp; &nbsp; <span style="color: #a61390;">printf</span><span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;Result: %i + %i = %i&quot;</span>, _numbera, _numberb, result<span style="color: #002200;">&#41;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setNumberA<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span> a<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; _numbera <span style="color: #002200;">=</span> a;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setNumberB<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span> b<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; _numberb <span style="color: #002200;">=</span> b;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span><br />
<br />
<br />
<br />
<br />
<span style="color: #a61390;">int</span> main<span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span> argc, <span style="color: #a61390;">char</span> <span style="color: #002200;">*</span>argv<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span><br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; Calculator <span style="color: #002200;">*</span>_calculator <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>Calculator new<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>_calculator setNumberA<span style="color: #002200;">:</span><span style="color: #2400d9;">15</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>_calculator setNumberB<span style="color: #002200;">:</span><span style="color: #2400d9;">7</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>_calculator print<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #a61390;">return</span> <span style="color: #2400d9;">0</span>;<br />
<span style="color: #002200;">&#125;</span></div></div>
<p>With the magic of Objective-C this complex application is capable of adding 15 to 7 which makes 22. Whew <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2009/02/08/objective-c-first-steps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

