<?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>Code Perspective &#187; Apple</title>
	<atom:link href="http://codeperspective.ca/category/apple/feed/" rel="self" type="application/rss+xml" />
	<link>http://codeperspective.ca</link>
	<description>Coding is awesome</description>
	<lastBuildDate>Wed, 25 Jan 2012 20:51:03 +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>Iphone Programming Part 2 &#8211; Intro to Views</title>
		<link>http://codeperspective.ca/2010/03/27/iphone-programming-part-2-intro-to-views/</link>
		<comments>http://codeperspective.ca/2010/03/27/iphone-programming-part-2-intro-to-views/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 19:32:45 +0000</pubDate>
		<dc:creator>Mark Hazlett</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Iphone]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/?p=235</guid>
		<description><![CDATA[Welcome to iphone programming part 2, introduction to views. In this tutorial I'll go over creating an application from scratch that transitions between 2 different views using the iphone's built in UINavigationController and the navigation stack. If you haven't done so already, I suggest reading through my first iphone article. If you already have a basic understanding of how to create an iphone application and hooking up IBOulets and IBActions in interface builder then you can head straight into this article. So let's jump into it, and as always if you have any questions feel free to leave a comment and I'll get back to you.]]></description>
			<content:encoded><![CDATA[<p>Welcome to iphone programming part 2, introduction to views. In this tutorial I&#8217;ll go over creating an application from scratch that transitions between 2 different views using the iphone&#8217;s built in UINavigationController and the navigation stack. If you haven&#8217;t done so already, I suggest reading through my first iphone article. If you already have a basic understanding of how to create an iphone application and hooking up IBOulets and IBActions in interface builder then you can head straight into this article. So let&#8217;s jump into it, and as always if you have any questions feel free to leave a comment and I&#8217;ll get back to you.</p>
<p>Let&#8217;s start out by opening up XCode and creating a new window based application from the standard iphone OS templates. Save the file to wherever you save your iphone files to and create.</p>
<p style="text-align: center;"><a href="http://www.codeperspective.ca/images/ViewTransitionDemo/createNewWindow.png"><img class="aligncenter" title="CreateNewWindowApplication" src="http://www.codeperspective.ca/images/ViewTransitionDemo/createNewWindow.png" alt="" width="287" height="217" /></a>Once you create and save your new window-based application, open up the classes and resources folders in the XCode folder explorer. Open up the ViewDemoAppDelegate.h and insert the following code&#8230;</p>
<p style="text-align: left;">

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//</span>
<span style="color: #666666; font-style: italic;">//  ViewDemoAppDelegate.h</span>
<span style="color: #666666; font-style: italic;">//  ViewDemo</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #666666; font-style: italic;">//  Created by Mark Hazlett on 10-03-26.</span>
<span style="color: #666666; font-style: italic;">//  Copyright Code Perspective 2010. All rights reserved.</span>
<span style="color: #666666; font-style: italic;">//</span>
&nbsp;
<span style="color: #339933;">#import &lt;UIKit/UIKit.h&gt;</span>
@interface ViewDemoAppDelegate <span style="color: #339933;">:</span> NSObject
<span style="color: #009900;">&#123;</span>
    UIWindow <span style="color: #339933;">*</span>window<span style="color: #339933;">;</span>
    UINavigationController <span style="color: #339933;">*</span>navController<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
@property <span style="color: #009900;">&#40;</span>nonatomic<span style="color: #339933;">,</span> retain<span style="color: #009900;">&#41;</span> IBOutlet UIWindow <span style="color: #339933;">*</span>window<span style="color: #339933;">;</span>
&nbsp;
@end</pre></div></div>

<p>All we&#8217;re doing here is creating a UINavigationController object so that we can access it in our application delegate implementation file. Let&#8217;s go ahead and open up our ViewDemoAppDelegate.m and add the following code to the application did finish launching method.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>applicationDidFinishLaunching<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>UIApplication <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>application
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//Allocate and instatiate a new UINavigationController Object</span>
	navController <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>UINavigationController alloc<span style="color: #009900;">&#93;</span> init<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Allocate and initialize a First View Controller Object</span>
	FirstViewController <span style="color: #339933;">*</span>firstViewController <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>FirstViewController alloc<span style="color: #009900;">&#93;</span>init<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Push the first view controller onto the view controller stack without animation</span>
	<span style="color: #009900;">&#91;</span>navController pushViewController<span style="color: #339933;">:</span>firstViewController animated<span style="color: #339933;">:</span>NO<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Some memory management</span>
	<span style="color: #009900;">&#91;</span>firstViewController release<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Make it visible</span>
	<span style="color: #009900;">&#91;</span>window	addSubview<span style="color: #339933;">:</span>navController.<span style="color: #202020;">view</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Override point for customization after application launch</span>
    <span style="color: #009900;">&#91;</span>window makeKeyAndVisible<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The first thing we&#8217;re doing in this function is instantiating the UINavigationController that we declared in our header. We pass it an alloc and init to allocate the appropriate amount of memory for it as well as an init to initialize it properly. The next thing we&#8217;re going to do is create a new FirstViewController object. Now you may be asking what a FirstViewController object is? That&#8217;s because we haven&#8217;t created it yet. So let&#8217;s go ahead and go to &#8220;File &gt; New File&#8221; and add a new file that&#8217;s of the type UIViewController subclass. Make sure you check the little check box that says &#8220;With XIB for user interface&#8221;. This will give you an XIB file to work with instead of producing your interface programmatically. Now that we have our FirstViewControllerObject the only thing we have to do is import the header into the ViewDemoAppDelegate. So make sure to declare #import &#8220;FirstViewController.h&#8221; at the top of your code. Now onto the rest of the code in our application did finish launching method. The first thing we do with our allocated view controller is push it onto the navigation stack. Now because this is our first view we&#8217;re pushing onto the navigation stack we want to make sure to pass &#8220;NO&#8221; to the animated parameter because we don&#8217;t want to animate the root view when it&#8217;s pushed onto the stack. Now for some memory management. Once the FirstViewController is pushed onto the navigation stack the retain count on the object moves up to 2, therefore we can perform a release on the FirstViewController object so that the retain count stays at 1. Last thing we do in this method is add the view so our window so that it&#8217;s actually visible when we load the application.</p>
<p>Now we&#8217;re going to get into some interface builder stuff. Let&#8217;s start by opening up our FirstViewController.xib file in Interface Builder(or by just double clicking on it). You should see just a plain white view. Now in order to transition between views we need a button to press to actually transition between views. So let&#8217;s go ahead and add a UIButton to the view. Label the button anything you would like to to transition between views. Go ahead and save that file for now(we&#8217;ll come back to it later to connect the pointers). Next we&#8217;re going to create a new file in our project that&#8217;s a subclass of UIViewController. Again we&#8217;re going to make sure that &#8220;use XIB for user interface&#8221; is selected and press create. We&#8217;re going to name this view controller &#8220;SecondViewController&#8221; as it&#8217;s the one that we transition to from pressing the button on our first view controller. Once you create the new View Controller you should see it appear on the left hand side in your package explorer. Let&#8217;s go into our FirstViewController.h and add the following code.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#import &lt;UIKit/UIKit.h&gt;</span>
@interface FirstViewController <span style="color: #339933;">:</span> UIViewController
<span style="color: #009900;">&#123;</span>
	IBOutlet UIButton <span style="color: #339933;">*</span>transitionButton<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>IBAction<span style="color: #009900;">&#41;</span> pushViewContoller<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span> send<span style="color: #339933;">;</span>
&nbsp;
@end</pre></div></div>

<p>All we do here is create an IBOutlet for the UIButton we added to the XIB file and call it transition button. Then we create an IBAction method that will get called whenever the user presses inside the UIButton. Let&#8217;s open up our FirstViewController.m implementation file and implement the IBAction method like so&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#import &quot;FirstViewController.h&quot;</span>
<span style="color: #339933;">#import &quot;SecondViewController.h&quot;</span>
&nbsp;
@implementation FirstViewController
&nbsp;
<span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>IBAction<span style="color: #009900;">&#41;</span> pushViewContoller<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span> send
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//Allocate and instantiate the second view controller object</span>
	SecondViewController <span style="color: #339933;">*</span>secondView <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>SecondViewController alloc<span style="color: #009900;">&#93;</span> init<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Push the secondViewController onto the navigation stack</span>
	<span style="color: #009900;">&#91;</span>self.<span style="color: #202020;">navigationController</span> pushViewController<span style="color: #339933;">:</span>secondView animated<span style="color: #339933;">:</span>YES<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Some memory management</span>
	<span style="color: #009900;">&#91;</span>secondView release<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now as you can see, we first provide our implementation with an import of the SecondViewController.h that we created earlier. We then proceed to allocate and instantiate our SecondViewController object. This time we&#8217;re going to push it onto our navigation stack and passing the YES parameter to our animated option because this time we do want it to be be animated when we press the button. After that we just provide some basic memory management to bring the retain count of the SecondViewController object back down to 1. That&#8217;s al the necessary code we need right now, however if you run this program right now you&#8217;ll notice that if you press the button on the first view controller it won&#8217;t really do anything. So let&#8217;s open back up our FirstViewController.xib file and hook up our IBOutlet and IBAction to our button that we created. After you&#8217;re finished hooking up these actions in the File&#8217;s owner connections inspector, the file&#8217;s owner connections inspector should look something like this..</p>
<p><a href="http://www.codeperspective.ca/images/ViewTransitionDemo/completedConnectionInspec.png"><img class="aligncenter" title="Completed Connections Inspec" src="http://www.codeperspective.ca/images/ViewTransitionDemo/completedConnectionInspec.png" alt="" width="301" height="247" /></a>Now you should be able to run the application and press the button and see the transition to the second view controller(which will be blank unless you added something to the nib) and press the back button in the navigation controller and transition back to the first screen.</p>
<p>If you&#8217;re having some troubles, here is the project and all the code. <a title="View Demo Download" href="http://codeperspective.ca/ViewDemo.zip" target="_blank">Download</a></p>
<p>Also again, if you have any questions feel free to leave them in the comments section.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2010/03/27/iphone-programming-part-2-intro-to-views/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Installing Cocos2D for the iphone</title>
		<link>http://codeperspective.ca/2010/03/09/installing-cocos2d-for-the-iphone/</link>
		<comments>http://codeperspective.ca/2010/03/09/installing-cocos2d-for-the-iphone/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 21:34:36 +0000</pubDate>
		<dc:creator>Mark Hazlett</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Iphone]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/?p=229</guid>
		<description><![CDATA[I have recently started working on some Iphone games only to discover a spectacular 2D game engine on the iphone called Cocos2D. After reading their very impressive feature list and some blogs on how Cocos2D works, I decided to try it out for myself. Low and behold however that it wasn't the easiest thing to install manually for iphone development. If you try and install cocos manually, you will run into countless errors and hassles while getting it up and running.]]></description>
			<content:encoded><![CDATA[<p>I have recently started working on some Iphone games only to discover a spectacular 2D game engine on the iphone called <a title="Cocos2D" href="http://cocos2d.org/" target="_blank">Cocos2D</a>. After reading their very impressive feature list and some blogs on how Cocos2D works, I decided to try it out for myself. Low and behold however that it wasn&#8217;t the easiest thing to install manually for iphone development. If you try and install cocos manually, you will run into countless errors and hassles while getting it up and running.</p>
<p>However, Cocos2D now sports a fancy shell script to get some Cocos2D templates up and running directly in Xcode with all the files pre-configured to start. To install these templates all you have to do is navigate to the cocos2D root directory on your filesystem using the terminal and then run this command.</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">./install_template.sh</pre></div></div>

<p>You can then open Xcode and you should see the following screen ready to use.</p>
<p style="text-align: center;">
<p style="text-align: center;"><a style="text-decoration: none;" href="http://codeperspective.ca/images/XCodePart1/cocos2d.png"><img class="aligncenter" title="Cocos2D" src="http://codeperspective.ca/images/XCodePart1/cocos2d.png" alt="" width="595" height="569" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2010/03/09/installing-cocos2d-for-the-iphone/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Iphone Programming Part 1 &#8211; Intro to Xcode and IB</title>
		<link>http://codeperspective.ca/2010/03/01/iphone-programming-part-1-intro-to-xcode-and-ib/</link>
		<comments>http://codeperspective.ca/2010/03/01/iphone-programming-part-1-intro-to-xcode-and-ib/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 23:40:01 +0000</pubDate>
		<dc:creator>Mark Hazlett</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS X Hints]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Interface Builder]]></category>
		<category><![CDATA[Iphone]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/?p=217</guid>
		<description><![CDATA[First off before we start, here are a couple of things you will need to get started: 1. Mac running the latest version of xcode &#8211; This can be found on your install disc for leopard or snow leopard. 2. Latest version of the iphone SDK &#8211; This can be found at developer.apple.com Now we [...]]]></description>
			<content:encoded><![CDATA[<p>First off before we start, here are a couple of things you will need to get started:</p>
<p>1. Mac running the latest version of xcode &#8211; This can be found on your install disc for leopard or snow leopard.</p>
<p>2. Latest version of the iphone SDK &#8211; This can be found at <a title="Apple Developer Connection" href="http://developer.apple.com" target="_blank">developer.apple.com</a></p>
<p>Now we can get started. Once you have xcode and the iphone SDK installed, open up xcode(Macintosh HD &gt; developer &gt; Applications). Once you have xcode installed, from the menu bar select file &gt; new project. You should see a windows like the this one.</p>
<p><a href="http://codeperspective.ca/images/XCodePart1/CreateNewProjectXcode.png"><img class="aligncenter" title="Create New XCode Project" src="http://codeperspective.ca/images/XCodePart1/CreateNewProjectXcode.png" alt="" width="716" height="641" /></a></p>
<p>Select window based application from the iphone application option on the left hand side of the window. Once you select the window based application, xcode will prompt you to save the project. I named my project &#8220;LabelTester&#8221; and saved it under my personal iphone projects directory. Once you save the project, an xcode window should open up and look something like this.</p>
<p style="text-align: center;"><a href="http://codeperspective.ca/images/XCodePart1/initialXcodeView.png"><img class="aligncenter" title="Initial XCode View" src="http://codeperspective.ca/images/XCodePart1/initialXcodeView.png" alt="" width="713" height="550" /></a></p>
<p>You should see a combination of files here in the browser in the code browser. The first should be the CoreGraphics.framework. This is just a set of files provided by Apple that have all the code relevant to the core graphics libraries in Cocoa. The second is the foundation.framework. This is the library set for the foundation framework which is basically all the classes like NSArray, NSString and other foundation objects. The next item should be LabelTester.plist. The plist, or preference list, is a set of XML attributes that control how the application is handled. For the sake of this tutorial, you won&#8217;t need to open the plist. The next item should be the LabelTester.app file, which is the executable for your application. Once your application is deployed, all files and resources in your project will be located inside your app&#8217;s .app file. The next file is the LabelTester.pch file. This file is the prefix header for your application. The LabelTesterAppDelegate.h file is the next file in the list. This file is the header file for your application delegate. This is the starting for your application, the app delegate is what&#8217;s run by your main.m file when you app is launched. The .h file is of course the header file, which is basically the interface file that the .m file will implement. The next file is of course the LabelTesterAppDelegate.m. This file is the implementation file for the app delegate header. Next is the main.m file. This file is the application launcher for your app. It basically runs the app delegate. The next file is the Main Window.xib file. Anything with a nib/xib file extension is classified as an interface builder file and you open these files in the Interface builder application. Finally, the UIKit.framework. This library is used to correspond to all the UI elements on the iphone(text fields, buttons, etc).</p>
<p>Let&#8217;s start by opening up our Main Window.xib to setup our interface. Start by dragging a button from the libraries window onto your main View. Rename that button by double clicking on the button and change it to say &#8220;Update Label!&#8221;. Next, grab a text field and drag it just above the button. Expand the text field to fit the majority of the screen. Select the textfield and go into the attributes tab and enter into the placeholder field, &#8220;Enter Text to update Label&#8221;. Once that&#8217;s finished, drag a label onto the main window and change the text from &#8220;label&#8221; to &#8220;Label to Update&#8221;. Once that&#8217;s done you can save the interface builder file by pressing (command + s) and switch your view back to your xcode project.</p>
<p><a href="http://codeperspective.ca/images/XCodePart1/IBIntroPage.png"><img class="aligncenter" title="IB Intro Page" src="http://codeperspective.ca/images/XCodePart1/IBIntroPage.png" alt="" width="707" height="710" /></a><a href="http://codeperspective.ca/images/XCodePart1/IBAddItems.png"><img class="aligncenter" title="IB Add Items" src="http://codeperspective.ca/images/XCodePart1/IBAddItems.png" alt="" width="400" height="582" /></a></p>
<p>Open up the LabelTesterAppDelegate.h file and change the file to reflect the following code.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#import </span>
&nbsp;
@interface LabelTesterAppDelegate <span style="color: #339933;">:</span> NSObject
<span style="color: #009900;">&#123;</span>
    UIWindow <span style="color: #339933;">*</span>window<span style="color: #339933;">;</span>
	IBOutlet UITextField <span style="color: #339933;">*</span>textField<span style="color: #339933;">;</span>
	IBOutlet UIButton <span style="color: #339933;">*</span>button<span style="color: #339933;">;</span>
	IBOutlet UILabel <span style="color: #339933;">*</span>label<span style="color: #339933;">;</span>
	IBAction <span style="color: #339933;">*</span>updateButtonPressed<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
@property <span style="color: #009900;">&#40;</span>nonatomic<span style="color: #339933;">,</span> retain<span style="color: #009900;">&#41;</span> IBOutlet UIWindow <span style="color: #339933;">*</span>window<span style="color: #339933;">;</span>
@property <span style="color: #009900;">&#40;</span>nonatomic<span style="color: #339933;">,</span> retain<span style="color: #009900;">&#41;</span> IBOutlet UITextField <span style="color: #339933;">*</span>textField<span style="color: #339933;">;</span>
@property <span style="color: #009900;">&#40;</span>nonatomic<span style="color: #339933;">,</span> retain<span style="color: #009900;">&#41;</span> IBOutlet UILabel <span style="color: #339933;">*</span>label<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span>IBAction<span style="color: #009900;">&#41;</span>updateButtonpressed<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span> sender<span style="color: #339933;">;</span>
&nbsp;
@end</pre></div></div>

<p>The first lines inside the curly braces will declare variables that we will be hooking up in Interface builder later. After the curly braces are closed, we have these property tags. These will allow us to have access to the objects and their data in the implementation file. After that we have an IBAction method declaration. This will eventually be hooked up to our button to run every time that our button is pressed. You can think of an IBAction method as an event handler in OBjective-C. Now let&#8217;s move onto our LabelTesterAppDelegate.m file and add the following method directly below out import statement.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#import &quot;LabelTesterAppDelegate.h&quot;</span>
&nbsp;
@implementation LabelTesterAppDelegate
&nbsp;
@synthesize window<span style="color: #339933;">;</span>
@synthesize textField<span style="color: #339933;">;</span>
@synthesize label<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span>IBAction<span style="color: #009900;">&#41;</span>updateButtonpressed<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span> sender
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//allocate a string and initialize it with the data from the text field</span>
	NSString <span style="color: #339933;">*</span>string <span style="color: #339933;">=</span> textField.<span style="color: #202020;">text</span><span style="color: #339933;">;</span>
&nbsp;
	label.<span style="color: #202020;">text</span> <span style="color: #339933;">=</span> string<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Basically what we&#8217;re doing here is just creating that IBAction method that we declared in our interface file. Inside that method, we allocate a string to the value of our textField.text and then set the label equal to the string that we get from the textfield. That&#8217;s all the code we&#8217;ll need for now. Don&#8217;t forget to synthesize your objects below the implementation declaration in order to have access to the data you want. If you try and run this now, the application will run but will not function because the pointers in Interface Builder are not hooked up. So let&#8217;s go ahead and do that next. Save all your xcode files and open back up your Main Window.xib file in Interface Builder.</p>
<p>In order to setup a pointer in Interface builder, start by clicking on the application delegate and then the connections manager should appear. Beside each of the items that you created you should see a tiny circle. For each, click on the circle and drag the pointer to each of the elements in your window. This will create a pointer to that element. Now click on the button and then open it&#8217;s connection manager. Find the &#8220;touch up inside&#8221; connection and drag that pointer to the &#8220;file&#8217;s owner&#8221; section in the library and select &#8220;updateButtonPressed&#8221; when it appears. Once this is completed, you should see the connection screen look something like this.</p>
<p><a href="http://codeperspective.ca/images/XCodePart1/IBConnections.png"><img class="aligncenter" title="IB Add Connections" src="http://codeperspective.ca/images/XCodePart1/IBConnections.png" alt="" width="301" height="259" /></a>That&#8217;s all folks, now if you run the application and enter some text into the text field, it will update the label to whatever text you entered. To download the whole project click <a title="XcodeProject For Label Tester" href="http://codeperspective.ca/LabelTester.zip" target="_self">here</a>.</p>
<p style="text-align: center;"><a style="text-decoration: none;" href="http://codeperspective.ca/images/XCodePart1/iphoneFinish.png"><img class="aligncenter" title="Iphone Finished Product" src="http://codeperspective.ca/images/XCodePart1/iphoneFinish.png" alt="" width="290" height="539" /></a></p>
<p style="text-align: center;">Cheers everyone and stay tuned for part 2!</p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2010/03/01/iphone-programming-part-1-intro-to-xcode-and-ib/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Mac OS X Tip: Adding Development tools to Apple&#8217;s WebKit</title>
		<link>http://codeperspective.ca/2009/08/19/mac-os-x-tip-adding-development-tools-to-apples-webkit/</link>
		<comments>http://codeperspective.ca/2009/08/19/mac-os-x-tip-adding-development-tools-to-apples-webkit/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 17:17:50 +0000</pubDate>
		<dc:creator>Mark Hazlett</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS X Hints]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/blog/?p=101</guid>
		<description><![CDATA[I&#8217;ve been looking for something that works in Safari kinda like Firebug does in Firefox. I recently learned that Apple includes it&#8217;s own web developer tool set inside safari. They are disabled by default, but the &#8220;Web Inspector&#8221; works just like firebug and even includes some features that firebug has yet to implement. This is [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking for something that works in Safari kinda like Firebug does in Firefox. I recently learned that Apple includes it&#8217;s own web developer tool set inside safari. They are disabled by default, but the &#8220;Web Inspector&#8221; works just like firebug and even includes some features that firebug has yet to implement. This is all included in a very friendly interface for you to work with.</p>
<p>To enable the web inspector in safari, open up a terminal window(Mac HD &gt; Applications &gt; Utilities &gt; Terminal) and type the following line&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;">defaults write com.apple.Safari WebKitDeveloperExtras <span style="color: #000000;">-</span>bool <span style="color: #0066ff;">true</span></pre></div></div>

<p>Restart Safari and the web inspector is now enabled.</p>
<p>To use the safari web inspector, right click on any element in a web page and choose &#8220;inspect element&#8221;. This will bring up a section in the bottom of your browser with the web inspector.</p>
<p>Cheers</p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2009/08/19/mac-os-x-tip-adding-development-tools-to-apples-webkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>13 must have apps for Mac OS X developers</title>
		<link>http://codeperspective.ca/2009/07/03/13-must-have-apps-for-mac-os-x-developers/</link>
		<comments>http://codeperspective.ca/2009/07/03/13-must-have-apps-for-mac-os-x-developers/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 22:37:30 +0000</pubDate>
		<dc:creator>Mark Hazlett</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/blog/?p=46</guid>
		<description><![CDATA[1. Apple Developer Tools &#8211; These are just a no-brainer here. There is a huge arsenal of apps that come standard with every mac that absolutely EVERY developer that is developing for mac os x needs. Xcode, Dashcode, Instruments, Interface Builder, etc. There are a ton more to check out if you haven&#8217;t already, and [...]]]></description>
			<content:encoded><![CDATA[<p>1. <a href="http://developer.apple.com/Tools/">Apple Developer Tools</a> &#8211; These are just a no-brainer here. There is a huge arsenal of apps that come standard with every mac that absolutely EVERY developer that is developing for mac os x needs. Xcode, Dashcode, Instruments, Interface Builder, etc. There are a ton more to check out if you haven&#8217;t already, and all of them will considerably ease your development experience on OS X.</p>
<p>2. <a href="http://www.eclipse.org/">Eclipse</a>- Eclipse is the ideal application for java development on Mac OS X. With the amount of features that eclipse offers, it&#8217;s almost impossible to skip this application if you do any level of java development. The &#8220;intellisense&#8221; that eclipse includes while you&#8217;re coding is unprecedented. </p>
<p>3. <a href="http://www.adobe.com/products/photoshop/compare/">Photoshop/ Gimp</a> &#8211; This is a must have for any type of website development/interface development. Whether it&#8217;s doing website mockups or drawing new buttons for your application, this is a must have.</p>
<p>4. <a href="http://www.panic.com/coda/">Coda</a> &#8211; I can&#8217;t speak enough good things about coda. This application has exceeded my expectations in every way possible. Whether it&#8217;s through the handy &#8220;sites&#8221; feature, or connecting to a server using the built in console, this is by far the best web development app for Mac OS X. Well worth the 100 bucks!</p>
<p>5.<a href="http://www.utorrent.com/">uTorrent</a> &#8211; A very simple torrent application. Extremely easy to use and very efficient. Having the ability to select which files you want to download and which you don&#8217;t is a huge bonus.</p>
<p>6. <a href="http://adium.im/">Adium</a> &#8211; A very powerful messenger application for Mac OS X. From IRC plugins, to customizing the look and feel, Adium can pretty much do it all.</p>
<p>7. <a href="http://www.jingproject.com/">Jing</a> &#8211; This screen capture application hides almost out of sight in your menu bar but packs some powerful features. Jing has the ability to capture screen casts of your applications in action as well as screen shots. Great App!</p>
<p>8. <a href="http://www.qtsoftware.com/products/developer-tools">QT Creator</a> &#8211; From the designer&#8217;s of the famous UI toolkit QT comes their first IDE. QT Creator is a fantastic IDE for developing QT Apps. From the WYSIWYG editor to the syntax editor, great app all around.</p>
<p>9. <a href="http://prism.mozilla.com/">Prism</a> &#8211; Pretty cool new(ish) app from Mozilla. This application allows you to capture sites like gmail and make them into a desktop application so you don&#8217;t have to open a browser every time you want to say check your email.</p>
<p>10. <a href="http://www.islayer.com/apps/istatmenus/">iStat Menu&#8217;s</a> &#8211; This light-weight app will allow you to truly track your applications performance and see if you potentially have a memory leak in your app. Has a separate monitor for each CPU to allow the user to see what&#8217;s going on in each CPU at any given time. A must have even for non-developers.</p>
<p>11. <a href="http://www.xmind.net/">XMind</a> &#8211; This extremely powerful mind-mapping tool is great for those pre-alpha stages of development. Getting as many ideas down as quick as possible is extremely easy for this application to handle. The application is based on the eclipse platform and is very solid.</p>
<p>12. <a href="http://www.virtualbox.org/">Virtual Box</a> &#8211; This open source application is great for testing applications in numerous environments. Test run your apps on Linux, Windows, BSD and more. </p>
<p>13. <a href="http://www.vmware.com/products/fusion/">VmWare Fusion</a> &#8211; This is a must have for all developers but especially for those doing web development with coda. Allows you to run windows applications natively on Mac OS X. Another great app for testing in multiple environments as well.</p>
<p>Cheers</p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2009/07/03/13-must-have-apps-for-mac-os-x-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

