<?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; Mac OS X Hints</title>
	<atom:link href="http://codeperspective.ca/category/mac-os-x-hints/feed/" rel="self" type="application/rss+xml" />
	<link>http://codeperspective.ca</link>
	<description>Coding is awesome</description>
	<lastBuildDate>Sun, 28 Mar 2010 16:00:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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>Code Perspective Admin</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 can get started. [...]]]></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><span style="color: #993333;">string</span> <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> <span style="color: #993333;">string</span><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>10</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>Code Perspective Admin</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>Mac OS X Tip: Getting a disc out on startup</title>
		<link>http://codeperspective.ca/2009/07/21/mac-os-x-tip-getting-a-disc-out-on-startup/</link>
		<comments>http://codeperspective.ca/2009/07/21/mac-os-x-tip-getting-a-disc-out-on-startup/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 20:19:33 +0000</pubDate>
		<dc:creator>Code Perspective Admin</dc:creator>
				<category><![CDATA[Mac OS X Hints]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/blog/?p=91</guid>
		<description><![CDATA[Sometimes when Mac OS X becomes unresponsive while writing to a disc or using a disc you can get the spinning beach ball and the disc will not eject. Don't panic there is an easy way to get it out. ]]></description>
			<content:encoded><![CDATA[<p>Sometimes when Mac OS X becomes unresponsive while writing to a disc or using a disc you can get the spinning beach ball and the disc will not eject. Don&#8217;t panic there is an easy way to get it out. </p>
<p>1. Hold down the power button until the computer shuts down<br />
2. Hold down the mouse button while turning on the computer and keep holding it down until the disc ejects.<br />
3. Let the computer boot normally<br />
4. That&#8217;s it! You&#8217;re done, disc should be out <img src='http://codeperspective.ca/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Cheers</p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2009/07/21/mac-os-x-tip-getting-a-disc-out-on-startup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X Tip: What is the .DS_Store file?</title>
		<link>http://codeperspective.ca/2009/07/20/mac-os-x-tip-what-is-the-ds_store-file/</link>
		<comments>http://codeperspective.ca/2009/07/20/mac-os-x-tip-what-is-the-ds_store-file/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 01:03:31 +0000</pubDate>
		<dc:creator>Code Perspective Admin</dc:creator>
				<category><![CDATA[Mac OS X Hints]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Mac OS X Hint]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/blog/?p=88</guid>
		<description><![CDATA[My last Mac OS X tip(found <a href="http://codeperspective.ca/blog/?p=86">Here</a> allows you to enable hidden folders in Mac OS X. Now if you have hidden folders enabled then you may be wondering what the .DS_Store file is in absolutely every single directory you go to?]]></description>
			<content:encoded><![CDATA[<p>My last Mac OS X tip(found <a href="http://codeperspective.ca/blog/?p=86">Here</a>) allows you to enable hidden folders in Mac OS X. Now if you have hidden folders enabled then you may be wondering what the .DS_Store file is in absolutely every single directory you go to?</p>
<p>The .DS_Store file is actually the way that spotlight is able to find things on your computer as quickly as it can. It indexes your directories whenever something changes, and that&#8217;s why when you plug in an external drive, it takes a while for spotlight to find items on it. This is because the .DS_Store file has to index the entire drive before spotlight can start finding anything. This means absolutely every single directory on the drive as well. So beware large drives can take a long time to index.</p>
<p>Hope this helps.</p>
<p>Cheers</p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2009/07/20/mac-os-x-tip-what-is-the-ds_store-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X Tip: Enable Hidden Folders in the finder</title>
		<link>http://codeperspective.ca/2009/07/20/mac-os-x-tip-enable-hidden-folders-in-the-finder/</link>
		<comments>http://codeperspective.ca/2009/07/20/mac-os-x-tip-enable-hidden-folders-in-the-finder/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 00:55:59 +0000</pubDate>
		<dc:creator>Code Perspective Admin</dc:creator>
				<category><![CDATA[Mac OS X Hints]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Mac OS X Hint]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/blog/?p=86</guid>
		<description><![CDATA[Ever wondered what's actually in the application you're installing on your mac? Or maybe you just want to access some folders that are hidden to configure some options. It's actually quite simple to do. Here are the few steps necessary to enable hidden folder view in Mac OS X.
]]></description>
			<content:encoded><![CDATA[<p>Ever wondered what&#8217;s actually in the application you&#8217;re installing on your mac? Or maybe you just want to access some folders that are hidden to configure some options. It&#8217;s actually quite simple to do. Here are the few steps necessary to enable hidden folder view in Mac OS X.</p>
<p>1. Open the Terminal(Macintosh HD > Applications > Utilities > Terminal).<br />
2. Type <code>defaults write com.apple.Finder AppleShowAllFiles YES</code> into the terminal window and press enter.<br />
3. Restart your computer or simply force quit the finder(restarting the finder)</p>
<p>That&#8217;s it, you now should see all the hidden folders in you finder.</p>
<p>Cheers</p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2009/07/20/mac-os-x-tip-enable-hidden-folders-in-the-finder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X Hint : Burning an Iso Image to a DVD</title>
		<link>http://codeperspective.ca/2009/07/10/mac-os-x-hint-burning-an-iso-image-to-a-dvd/</link>
		<comments>http://codeperspective.ca/2009/07/10/mac-os-x-hint-burning-an-iso-image-to-a-dvd/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 18:52:17 +0000</pubDate>
		<dc:creator>Code Perspective Admin</dc:creator>
				<category><![CDATA[Mac OS X Hints]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Mac OS X Hint]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://codeperspective.ca/blog/?p=79</guid>
		<description><![CDATA[If you've ever downloaded a linux distro in the form of an ISO disc image, you may be wondering how to burn it to a DVD in order to make it bootable. So here are the steps for burning an ISO disc image to a DVD. All you need to get started is a blank DVD, and a linux distro ISO image.]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever downloaded a linux distro in the form of an ISO disc image, you may be wondering how to burn it to a DVD in order to make it bootable. So here are the steps for burning an ISO disc image to a DVD. All you need to get started is a blank DVD, and a linux distro ISO image.</p>
<p>1. Insert the blank disc into your mac. When it pops up asking how you want to open it, choose finder.<br />
2. Open Disc Utility(Macintosh HD > Applications > Utilities > Disk Utility), and you should see the dvd on the left hand menu bar.<br />
3. Choose File > Open Disk Image and you should see the mounted disk image on the left hand menu bar below the dvd you inserted.<br />
4. Click on the ISO file(not the mounted drive) and then click burn at the top left corner of the disk utility window.<br />
5. Follow the onscreen instructions and choose the options you want to burn the disc with.<br />
6. Click &#8220;Burn&#8221;</p>
<p>That&#8217;s it, the disc should start burning and eject on it&#8217;s own unless otherwise specified. It&#8217;s slightly hidden but pretty straight forward once you know where to go.</p>
<p>Cheers</p>
]]></content:encoded>
			<wfw:commentRss>http://codeperspective.ca/2009/07/10/mac-os-x-hint-burning-an-iso-image-to-a-dvd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
