<?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>designerd ::</title>
	<atom:link href="http://kellenstyler.com/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://kellenstyler.com</link>
	<description>playground for Kellen Styler</description>
	<lastBuildDate>Fri, 20 Jan 2012 14:53:10 +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>I am now at D3signerd.com</title>
		<link>http://kellenstyler.com/index.php/2012/01/20/i-am-now-at-d3signerd-com/</link>
		<comments>http://kellenstyler.com/index.php/2012/01/20/i-am-now-at-d3signerd-com/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 14:52:22 +0000</pubDate>
		<dc:creator>flakeskstyle</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[iOS Application]]></category>
		<category><![CDATA[iOS Tips and Tricks]]></category>
		<category><![CDATA[iOSOpenSource]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Site History]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Version History]]></category>

		<guid isPermaLink="false">http://kellenstyler.com/?p=2802</guid>
		<description><![CDATA[I am in the process of moving all my content over to a new hosting provider. You will now be able to follow me and my rants over at www.d3signerd.com]]></description>
			<content:encoded><![CDATA[<p>I am in the process of moving all my content over to a new hosting provider.  You will now be able to follow me and my rants over at <a href="www.d3signerd.com">www.d3signerd.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kellenstyler.com/index.php/2012/01/20/i-am-now-at-d3signerd-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Turn FIXME, TODO, and !!! comments into compiler warnings within xcode</title>
		<link>http://kellenstyler.com/index.php/2011/10/05/turn-fixme-todo-and-comments-into-compiler-warnings-within-xcode/</link>
		<comments>http://kellenstyler.com/index.php/2011/10/05/turn-fixme-todo-and-comments-into-compiler-warnings-within-xcode/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 19:21:01 +0000</pubDate>
		<dc:creator>flakeskstyle</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[FIXME]]></category>
		<category><![CDATA[TODO]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://kellenstyler.com/?p=2076</guid>
		<description><![CDATA[I have written a few posts on how to customize the jump bar function menu in xcode. If you have not seen them click on the links below. Read more about #pragma marks Read more about FIXME, TODO, !!! OK, great&#8230; Now you can see how customizing the jump bar function menu in xcode can [...]]]></description>
			<content:encoded><![CDATA[<p class="pageDivide">
<p><span style="font-size: 32px; color:rgba(215, 89, 76, 0.5);">I</span> have written a few posts on how to customize the jump bar function menu in xcode.  If you have not seen them click on the links below.</p>
<p style="margin-bottom:30px;"><a href="http://kellenstyler.com/?p=1760" target="_blank" class="read-more" style="float:left;"><span>Read more about #pragma marks </span></a></p>
<p><a href="http://kellenstyler.com/?p=1994" target="_blank" class="read-more" style="float:left;"><span>Read more about FIXME, TODO, !!!</span></a></p>
<p></br></p>
<p style="padding-top:30px;">OK, great&#8230; Now you can see how customizing the jump bar function menu in xcode can make browsing your code within a single file easier.  But, we are missing the ability to find these flags or notes from within the xcode IDE.   I wanted to make the FIXME , TODO, ??? and !!! comments a little more useful.  So, after some research I found a solution by Jake Marsh ( See references following this tutorial ).  What he had done was expand off a code example that takes these comments as your application builds and turns them into compiler warnings.  You can then see your comments and descriptions in the compiler warnings list.  You can also jump to that comment just like a normal warning can from within xcode.  Now, these are useful!</p>
<p><span id="more-2076"></span></p>
<p>Lets take a look on how to add this functionality to your xcode project.</p>
<p class="subTitleContent"><span class="subTitle">^Adding FIXME , TODO and !!! as compiler warnings</span></p>
<p class="pageDivide">
<p>The first step is to go into your project navigator and select your project</p>
<p><img class="post-image" src="http://www.kellenstyler.com/wp-content/posts/iOSFIXMETODOWarnings/selectProject.jpg" width='353' height='333' /></p>
<p></br></p>
<p>Next you will need to select your application target</p>
<p><img class="post-image" src="http://www.kellenstyler.com/wp-content/posts/iOSFIXMETODOWarnings/selectTarget.jpg" width='284' height='278' /></p>
<p></br></p>
<p>And then select the <b>Build Phases</b> tab</p>
<p><img class="post-image" src="http://www.kellenstyler.com/wp-content/posts/iOSFIXMETODOWarnings/selectBuildPhases.jpg" width='480' height='286' /></p>
<p></br></p>
<p>Then click on the <b>Add Build Phase</b> button down in the bottom right corner and select “<b>Add Run Script</b>”</p>
<p><img class="post-image" src="http://www.kellenstyler.com/wp-content/posts/iOSFIXMETODOWarnings/pressAddBuildPhase.jpg" width='300' height='200' /></p>
<p></br></p>
<p>Now we add the script!</b></p>
<p>Make sure that the <b>Run Script</b> group is expanded.</p>
<p><img class="post-image" src="http://www.kellenstyler.com/wp-content/posts/iOSFIXMETODOWarnings/runScript.jpg" width='401' height='363' /></p>
<p></br></p>
<p>Then all we need to do is add the script below under the Shell input area.  ( See image above for an example )</p>
<p></br></p>
<p><span class="subTitleGreenSmall">TODO, FIXME, ???, !!! script</span></p>
<pre>
KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
</pre>
<p>That’s it!!</p>
<p class="subTitleContent"><span class="subTitle">^Testing</span></p>
<p class="pageDivide">
<p>That was the hard part.  Now all you have to do is add a FIXME, TODO, ???, !!! comment to your code and build your application.</p>
<p>For example, if you add this to any header or implementation file.</p>
<div class="attention-box">
<div class="attention-box-content"><span class="attention-box-icon">!!</span><span class="attention-box-text">If your TODO, FIXME, !!!, or ??? comments are within function brackets they will not show up in the jump bar function menu.  They will still come up as warnings in your compiler warning list.</span></div>
</div>
<p><span class="subTitleGreenSmall">// TODO:</span></p>
<pre>
// TODO: test me
</pre>
<p>It should come up like this from within your compiler warnings list when you try to build your project.</p>
<p><img class="post-image" src="http://www.kellenstyler.com/wp-content/posts/iOSFIXMETODOWarnings/exampleWarning.jpg" width='331' height='264' /></p>
<p></br></p>
<p>Nice right?  Now try clicking on it to see what happens!</p>
<p>I hope this was useful for you, it was for me.  Also I want to thank Jake Marsh, Deallocated Objects, for making our lives a little easier.</p>
<p class="subTitleContent"><span class="subTitle">^References</span></p>
<p class="pageDivide">
<p><a href="http://deallocatedobjects.com/2011/05/11/show-todos-and-fixmes-as-warnings-in-xcode-4/" target="_blank" class="read-more" style="float:left;"><span>Read More: Jake Marsh warning script post</span></a></p>
]]></content:encoded>
			<wfw:commentRss>http://kellenstyler.com/index.php/2011/10/05/turn-fixme-todo-and-comments-into-compiler-warnings-within-xcode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customizing the Jump bar function menu in xcode with TODO, FIXME, and more</title>
		<link>http://kellenstyler.com/index.php/2011/10/04/customizing-the-jump-bar-function-menu-in-xcode-with-todo-fixme-and-more/</link>
		<comments>http://kellenstyler.com/index.php/2011/10/04/customizing-the-jump-bar-function-menu-in-xcode-with-todo-fixme-and-more/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 21:05:17 +0000</pubDate>
		<dc:creator>flakeskstyle</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[FIXME]]></category>
		<category><![CDATA[TODO]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://kellenstyler.com/?p=1994</guid>
		<description><![CDATA[Here I will show you a few examples of how to customize the the jump bar function menu within xcode. These work very similar to the #pragma mark directive. Haven’t use one before? Click the link below to read more about what they are and how to use them. Learn more about Pragma Marks OK, [...]]]></description>
			<content:encoded><![CDATA[<p class="pageDivide">
<p><span style="font-size: 32px; color:rgba(215, 89, 76, 0.5);">H</span>ere I will show you a few examples of how to customize the the jump bar function menu within xcode.  These work very similar to the #pragma mark directive.  Haven’t use one before?  Click the link below to read more about what they are and how to use them.</p>
<p><a href="http://kellenstyler.com/?p=1760" class="read-more" style="float:left;"><span>Learn more about Pragma Marks</span></a></p>
<p></br></p>
<p style="padding-top:30px;">OK, so what am I talking about?  Well, just like the <b>#pragma</b> mark directive, adding a <b>FIXME</b>, <b>TODO</b>, <b>MARK</b>, <b>???</b> or <b>!!!</b> comment will add notes to your jump bar function menu within xcode.  These notes can then also be used for navigation within your header or implementation files.  Lets take a look at the examples below and see the different options available!</p>
<p><span id="more-1994"></span></p>
<div class="attention-box">
<div class="attention-box-content"><span class="attention-box-icon">!!</span><span class="attention-box-text">The examples below need to be outside of function brackets in order to show up in the jump bar function menu.</span></div>
</div>
<p><span class="subTitleGreenSmall">FIXME</span></p>
<pre>
// FIXME: your text here...
</pre>
<p><span class="subTitleGreenSmall">TODO</span></p>
<pre>
// TODO: your text here...
</pre>
<p><span class="subTitleGreenSmall">MARK</span></p>
<pre>
// MARK: your text here...
</pre>
<p><span class="subTitleGreenSmall">???</span></p>
<pre>
// ???: your text here...
</pre>
<p><span class="subTitleGreenSmall">!!!</span></p>
<pre>
// !!!: your text here...
</pre>
<p class="subTitleContent"><span class="subTitle">^What does it look like?</span></p>
<p class="pageDivide">
<p>This is an example of what the above code could look like.</p>
<p><img class="post-image" src="http://www.kellenstyler.com/wp-content/posts/iOSCustomJumpbarFunctionMenu/customMenu.jpg" width='560' height='300' /></p>
]]></content:encoded>
			<wfw:commentRss>http://kellenstyler.com/index.php/2011/10/04/customizing-the-jump-bar-function-menu-in-xcode-with-todo-fixme-and-more/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Add custom Warning messages to your code in Objective-C</title>
		<link>http://kellenstyler.com/index.php/2011/10/04/add-custom-warning-messages-to-your-code-in-objective-c/</link>
		<comments>http://kellenstyler.com/index.php/2011/10/04/add-custom-warning-messages-to-your-code-in-objective-c/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 20:13:49 +0000</pubDate>
		<dc:creator>flakeskstyle</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Warning]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://kellenstyler.com/?p=1973</guid>
		<description><![CDATA[W e have all seen Objective-C warnings while building out an application. But there may be an instance where you need to write your own custom warning messages. To my surprise Xcode will pick up the “#warning” flag in the compiler. This will allow you to add your own custom warnings anywhere within your code. [...]]]></description>
			<content:encoded><![CDATA[<p class="pageDivide">
<p><span style="font-size: 32px; color:rgba(215, 89, 76, 0.5);">W</span> e have all seen Objective-C warnings while building out an application.  But there may be an instance where you need to write your own custom warning messages.  To my surprise Xcode will pick up the “<b>#warning</b>” flag in the compiler.  This will allow you to add your own custom warnings anywhere within your code.</p>
<p><span id="more-1973"></span></p>
<div class="attention-box">
<div class="attention-box-content"><span class="attention-box-icon">!!</span><span class="attention-box-text">Be careful, your message must be contained within quotes.</span></div>
</div>
<p>Below is the correct syntax.</p>
<p style="padding-top:30px;"><span class="subTitleGreenSmall">#Warning</span></p>
<pre>
#warning "Your custom warning message..."
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kellenstyler.com/index.php/2011/10/04/add-custom-warning-messages-to-your-code-in-objective-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pragma Mark to organize your source code</title>
		<link>http://kellenstyler.com/index.php/2011/09/26/pragma-mark-to-organize-your-source-code/</link>
		<comments>http://kellenstyler.com/index.php/2011/09/26/pragma-mark-to-organize-your-source-code/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 20:59:50 +0000</pubDate>
		<dc:creator>flakeskstyle</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Directive]]></category>
		<category><![CDATA[Pragma Mark]]></category>

		<guid isPermaLink="false">http://kellenstyler.com/?p=1760</guid>
		<description><![CDATA[Pagma Marks are simple directives that you can add to your source code to help with organization. They can be added to both xcode header and implementation files. The main benefit will come when you use the jump bar, within xcode, to find functions within your code. Pragma Marks will show up in the function [...]]]></description>
			<content:encoded><![CDATA[<p class="pageDivide">
<p><span style="font-size: 32px; color:rgba(215, 89, 76, 0.5);">P</span><b>agma Marks</b> are simple directives that you can add to your source code to help with organization.  They can be added to both xcode header and implementation files.  The main benefit will come when you use the jump bar, within xcode, to find functions within your code.  Pragma Marks will show up in the function drop-down menu and work as clickable short cuts that jump to sections within your files.</p>
<p><span id="more-1760"></span></p>
<p>For example this is what the function drop-down could look like when you are not using <b>Pragma Marks</b>.</p>
<p><img class="post-image" src="http://www.kellenstyler.com/wp-content/posts/iOSPragmaMarks/NoMarks.jpg" width='560' height='380' /></p>
<p></br></p>
<p>This is what it could look like when you are using <b>Pragma Marks</b>.</p>
<p><img class="post-image" src="http://www.kellenstyler.com/wp-content/posts/iOSPragmaMarks/Marks.jpg" width='560' height='380' /></p>
<p class="subTitleContent"><span class="subTitle">^Adding Pragma Marks</span></p>
<p class="pageDivide">
<p> Its really simple to use <b>Pragma Marks</b>.  Try adding the examples below to see how they work.</p>
<p></br></p>
<p><span class="subTitleGreenSmall">Adding a divider</span></p>
<pre>
#pragma mark -
</pre>
<p><span class="subTitleGreenSmall">Adding a label</span></p>
<pre>
#pragma mark Your Mark Name
</pre>
<p><span class="subTitleGreenSmall">Combining them together</span></p>
<pre>
#pragma mark - Your Mark Name
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kellenstyler.com/index.php/2011/09/26/pragma-mark-to-organize-your-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Macros for your Objective-C and iOS projects</title>
		<link>http://kellenstyler.com/index.php/2011/09/21/add-macros-to-your-objective-c-and-ios-projects/</link>
		<comments>http://kellenstyler.com/index.php/2011/09/21/add-macros-to-your-objective-c-and-ios-projects/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 21:55:51 +0000</pubDate>
		<dc:creator>flakeskstyle</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[iOSOpenSource]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Macros]]></category>
		<category><![CDATA[OpenSource]]></category>

		<guid isPermaLink="false">http://kellenstyler.com/?p=1648</guid>
		<description><![CDATA[Download Example M acros can be described as snippets of code that you can frequently use over and over again while developing an application. They can also make your code less verbose&#8230;. *hint&#8230; What we have here is a quick example on how to add macros to your project and then it is followed up [...]]]></description>
			<content:encoded><![CDATA[<p class="pageDivide">
<p><a class="icon-button download-icon" href="http://www.kellenstyler.com/wp-content/posts/iOSMacros/Macros.zip"><span class="et-icon"><span>Download Example</span></span></a></p>
<p style="padding-top:60px;"><span style="font-size: 32px; color:rgba(215, 89, 76, 0.5);">M</span> acros can be described as snippets of code that you can frequently use over and over again while developing an application.  They can also make your code less verbose&#8230;. *hint&#8230;  What we have here is a quick example on how to add macros to your project and then it is followed up by a growing collection of macros for you to pick and choose from.</p>
<p class="subTitleContent"><span class="subTitle">^Adding Macros to your project</span></p>
<p class="pageDivide">
<p>Adding macros to your iOS project only takes a few simple steps.</p>
<p>Lets start by creating a new header file within your project.  I have named mine “iOSMacros”.  Now, click on the new header file to open it up.  It should resemble something like the code below.</p>
<p><span id="more-1648"></span><br />
</br></p>
<p><span class="subTitleGreenSmall">iOSMacros.h</span></p>
<pre>
//
//  iOSMacros.h
//  Macros
//
//  Created by Kellen Styler on 9/20/11.
//  Copyright (c) 2011 Mine. All rights reserved.
//

#ifndef Macros_iOSMacros_h
#define Macros_iOSMacros_h

<b>// Put your Macros here...</b>

#endif
</pre>
<p>All you have to do now is add your custom list of macros to the area labeled “Put your Macros here&#8230; “.   Once your finished, just import your new Macros.h file into your class implementation files.  Done!</p>
<p class="subTitleContent"><span class="subTitle">^List O’ Macros</span></p>
<p class="pageDivide">
<p>This list will grown over time and should help you to get started.  Feel free to share anything you do not see below!</p>
<p></br></p>
<p><span class="subTitleGreenSmall">Device Info</span></p>
<p><a class="icon-button download-icon" href="http://www.kellenstyler.com/wp-content/posts/iOSMacros/UIDevice+Extended.zip"><span class="et-icon"><span>Download UIDevice+Extended</span></span></a></p>
<p></br></p>
<pre>
/** String: Identifier **/
#define DEVICE_IDENTIFIER ( ( IS_IPAD ) ? DEVICE_IPAD : ( IS_IPHONE ) ? DEVICE_IPHONE , DEVICE_SIMULATOR )

/** String: iPhone **/
#define DEVICE_IPHONE @"iPhone"

/** String: iPad **/
#define DEVICE_IPAD @"iPad"

/** String: Device Model **/
#define DEVICE_MODEL ( [[UIDevice currentDevice ] model ] )

/** String: Localized Device Model **/
#define DEVICE_MODEL_LOCALIZED ( [[UIDevice currentDevice ] localizedModel ] )

/** String: Device Name **/
#define DEVICE_NAME ( [[UIDevice currentDevice ] name ] )

/** Double: Device Orientation **/
#define DEVICE_ORIENTATION ( [[UIDevice currentDevice ] orientation ] )

/** String: Simulator **/
#define DEVICE_SIMULATOR @"Simulator"

/** String: Device Type **/
/** Import UIDevice+Extended.h **/
#define DEVICE_TYPE ( [[UIDevice currentDevice ] deviceType ] )

/** BOOL: Detect if device is an iPad **/
#define IS_IPAD ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )

/** BOOL: Detect if device is an iPhone or iPod **/
#define IS_IPHONE ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone )

/** BOOL: IS_RETINA **/
#define IS_RETINA ( [[UIScreen mainScreen] respondsToSelector:@selector(scale)] &#038;&#038; [[UIScreen mainScreen] scale] == 2 )

/** BOOL: Detect if device is the Simulator **/
#define IS_SIMULATOR ( TARGET_IPHONE_SIMULATOR )
</pre>
<p><span class="subTitleGreenSmall">System Info</span></p>
<pre>
/** String: System Name **/
#define SYSTEM_NAME ( [[UIDevice currentDevice ] systemName ] )

/** String: System Version **/
#define SYSTEM_VERSION ( [[UIDevice currentDevice ] systemVersion ] )
</pre>
<p style="padding-top:30px;"><span class="subTitleGreenSmall">Screen Info</span></p>
<pre>
/** CGRect: Portrait Screen Frame **/
#define SCREEN_FRAME_PORTRAIT ( CGRectMake( 0, 0, SCREEN_WIDTH_PORTRAIT , SCREEN_HEIGHT_PORTRAIT ) )

/** CGRect: Landscape Screen Frame **/
#define SCREEN_FRAME_LANDSCAPE ( CGRectMake( 0, 0, SCREEN_WIDTH_LANDSCAPE , SCREEN_HEIGHT_LANDSCAPE ) )

/** Float: Portrait Screen Height **/
#define SCREEN_HEIGHT_PORTRAIT ( [[UIScreen mainScreen ] bounds ].size.height )

/** Float: Landscape Screen Height **/
#define SCREEN_HEIGHT_LANDSCAPE ( [[UIScreen mainScreen ] bounds ].size.width )   

/** Float: Screen Scale **/
#define SCREEN_SCALE ([[UIScreen mainScreen] scale ] )

/** Float: Portrait Screen Width **/
#define SCREEN_WIDTH_PORTRAIT ( [[UIScreen mainScreen ] bounds ].size.width )

/** Float: Landscape Screen Width **/
#define SCREEN_WIDTH_LANDSCAPE ( [[UIScreen mainScreen ] bounds ].size.height )
</pre>
<p><span class="subTitleGreenSmall">Colors</span></p>
<p><a class="icon-button download-icon" href="http://www.kellenstyler.com/wp-content/posts/iOSMacros/UIDevice+Extended.zip"><span class="et-icon"><span>Download UIColor+Extended</span></span></a></p>
<p></br></p>
<pre>
/** UIColor: Color From Hex **/
/** Import UIColor+Extended.h **/
#define colorFromHex( rgbValue ) ( [UIColor UIColorFromRGB:rgbValue ] )

/** UIColor: Color from RGB **/
#define colorFromRGB( r , g , b ) ( [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1 ] )

/** UIColor: Color from RGBA **/
#define colorFromRGBA(r , g , b , a ) ( [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a ] )
</pre>
<p><span class="subTitleGreenSmall">Degrees to Radians / Radians to Degrees</span></p>
<pre>
/** Float: Degrees -> Radian **/
#define degreesToRadians( degrees ) ( ( degrees ) / 180.0 * M_PI )

/** Float: Radians -> Degrees **/
#define radiansToDegrees( radians ) ( ( radians ) * ( 180.0 / M_PI ) )
</pre>
<p class="subTitleContent"><span class="subTitle">^Need an Example?</span></p>
<p class="pageDivide">
<p>I put together an example application that contains everything you see above.  Click the button below to get the source code.  Enjoy!</p>
<p><a class="icon-button download-icon" href="http://www.kellenstyler.com/wp-content/posts/iOSMacros/Macros.zip"><span class="et-icon"><span>Download Example</span></span></a></p>
]]></content:encoded>
			<wfw:commentRss>http://kellenstyler.com/index.php/2011/09/21/add-macros-to-your-objective-c-and-ios-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Degrees to Radians and Radians to Degrees in Objective-C</title>
		<link>http://kellenstyler.com/index.php/2011/09/20/degrees-to-radians-and-radian-to-degrees-in-objective-c/</link>
		<comments>http://kellenstyler.com/index.php/2011/09/20/degrees-to-radians-and-radian-to-degrees-in-objective-c/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 22:16:51 +0000</pubDate>
		<dc:creator>flakeskstyle</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Macros]]></category>

		<guid isPermaLink="false">http://kellenstyler.com/?p=1650</guid>
		<description><![CDATA[T here are a few places in Objective-C that require radians instead of degrees and it is a pain to constantly calculate between the two. So here is a quick and easy way to add that functionality into your view. Add these two macros right above “@implementation” in your classes implementation file. YourViewController.m // // [...]]]></description>
			<content:encoded><![CDATA[<p class="pageDivide">
<p><span style="font-size: 32px; color:rgba(215, 89, 76, 0.5);">T</span> here are a few places in Objective-C that require radians instead of degrees and it is a pain to constantly calculate between the two.  So here is a quick and easy way to add that functionality into your view.</p>
<p>Add these two macros right above “@implementation” in your classes implementation file.</p>
<p></br></p>
<p><span class="subTitleGreenSmall">YourViewController.m</span></p>
<pre>

//
//  iOSViewController.m
//  Macros
//
//  Created by Kellen Styler on 9/20/11.
//  Copyright (c) 2011 Mine. All rights reserved.
//

#import "iOSViewController.h"

<b>/** Degrees to Radian **/
#define degreesToRadians( degrees ) ( ( degrees ) / 180.0 * M_PI )</b>

<b>/** Radians to Degrees **/
#define radiansToDegrees( radians ) ( ( radians ) * ( 180.0 / M_PI ) )</b>

@implementation iOSViewController

@end
</pre>
<p><span id="more-1650"></span> </p>
<p>This will now allow you to access these macros anywhere in your code.  See the example below.</p>
<pre>
- (void)viewDidLoad
    {
        [super viewDidLoad]; 

        float myDegrees = radiansToDegrees( radians );
        float myRadians = degreesToRadians( degrees );
    }
</pre>
<p class="subTitleContent"><span class="subTitle">^Want more?</span></p>
<p class="pageDivide">
<p>I have put together a list of useful macros to use in Objective-C.  Click the link below to learn more!</p>
<p><a href="http://kellenstyler.com/?p=1648" class="read-more" style="margin-top:10px"><span>Learn More</span></a></p>
]]></content:encoded>
			<wfw:commentRss>http://kellenstyler.com/index.php/2011/09/20/degrees-to-radians-and-radian-to-degrees-in-objective-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding TouchOutside functionality to a UIView in iOS</title>
		<link>http://kellenstyler.com/index.php/2011/09/20/adding-touchoutside-functionality-to-a-uiview-in-ios/</link>
		<comments>http://kellenstyler.com/index.php/2011/09/20/adding-touchoutside-functionality-to-a-uiview-in-ios/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 12:00:19 +0000</pubDate>
		<dc:creator>flakeskstyle</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[UIView]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://kellenstyler.com/?p=1546</guid>
		<description><![CDATA[Download Example A pple has done a good job in regards to touch notifications within the UIView. But, as with any framework, I need just a little more. I kept running into situations that required the need to know if the user has tapped outside of a UIView’s bounds. As you may have guessed, Apple [...]]]></description>
			<content:encoded><![CDATA[<p class="pageDivide">
<p><a class="icon-button download-icon" href="http://www.kellenstyler.com/wp-content/posts/iOSTouchesOutside/TouchOutside.zip"><span class="et-icon"><span>Download Example</span></span></a></p>
<p style="padding-top:60px;"><span style="font-size: 32px; color:rgba(215, 89, 76, 0.5);">A</span> pple has done a good job in regards to touch notifications within the UIView.  But, as with any framework, I need just a little more.  I kept running into situations that required the need to know if the user has tapped outside of a UIView’s bounds.  As you may have guessed, Apple did not bake this into the default UIView functionality.   So I decided to put together a clean solution and in the end I was able to create a simple delegate enabled UIView that could easily be added to your project.</p>
<p>Lets walk through creating this functionality in a UIView and then how to add it to a project.</p>
<p class="subTitleContent"><span class="subTitle">^Creating our Touch Outside enabled UIView</span></p>
<p class="pageDivide">
<p>To start off we are going to create the custom UIView classes.  Create two new files in your project and name them “TOTouchUIView.h” and “TOTouchUIView.m”.  The open up the  new header file, TOTouchUIView.h, and add the following lines of code in bold.</p>
<p><span id="more-1546"></span><br />
</br></p>
<p><span class="subTitleGreenSmall">TOTouchUIView.h</span></p>
<pre>
//
//  TOTouchUIView.h
//  TouchOutside
//
//  Created by Kellen Styler on 9/19/11.
//  Copyright (c) 2011 Mine. All rights reserved.
//

#import <UIKit/UIKit.h>

<b>@protocol TOTouchUIViewDelegate

- (void) uiViewTouched:(BOOL)wasInside;

@end</b>

@interface TOTouchUIView : UIView 

// Properties
<b>@property (nonatomic, assign) id<TOTouchUIViewDelegate> delegate;</b>

@end
</pre>
<p>Great!  Lets quickly go over what we just did.</p>
<p>“<b>TOTouchUIViewDelegate</b>” is the name of our new delegate protocol for our Touch UIView.  You can name this anything way you want but I like to keep my View and Delegate names similar.  It makes life less confusing in the future.</p>
<p>“<b>uiViewTouched</b>” is the method that we will use to tell our delegate whether the touches were inside or outside of our view’s bounds.</p>
<p>“<b>delegate</b>“ will be the property that we will use later on to register our UIView’s delegate.</p>
<p>OK, now lets step in into our TOTouchUIView implementation file, TOTouchUIView.m.</p>
<p></br></p>
<p><span class="subTitleGreenSmall">TOTouchUIView.m</span></p>
<pre>
//
//  TOTouchUIView.m
//  TouchOutside
//
//  Created by Kellen Styler on 9/19/11.
//  Copyright (c) 2011 Mine. All rights reserved.
//

#import "TOTouchUIView.h"

@implementation TOTouchUIView

#pragma mark - Synthesize
<b>@synthesize delegate;</b>

#pragma mark - Touches
<b>- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
    if( point.x > 0 &#038;&#038; point.x < self.frame.size.width &#038;&#038; point.y > 0 &#038;&#038; point.y < self.frame.size.height )
    {
        [delegate uiViewTouched:YES ];
        return YES;
    }

    [delegate uiViewTouched:NO ];
    return NO;
}</b>
@end
</pre>
<p>Again, a quick recap.</p>
<p>First we synthesized our delegate property in order to access it from outside of our TOTouchUIView. Then we override the “<b>pointInside</b>” instance method from the base UIVIew class.  This will allow us to measure whether or not the users touch came from inside or outside of the UIView bounds.  Then we fire off the “<b>uiViewTouched</b>” delegate method to let our delegate know our findings.  Inside or outside.</p>
<p>It’s that simple!</p>
<p class="subTitleContent"><span class="subTitle">^Adding the TOTouchUIView </span></p>
<p class="pageDivide">
<p>Now we can easily add our new TOTouchUIView to any class with only a few lines of code!   Look at the example below.  The lines below, in bold, show you how to add this functionality to a Views header file.</p>
<p></br></p>
<p><span class="subTitleGreenSmall">YourViewController.h</span></p>
<pre>

//
//  TOViewController.h
//  TouchOutside
//
//  Created by Kellen Styler on 9/19/11.
//  Copyright (c) 2011 Mine. All rights reserved.
//

#import <UIKit/UIKit.h> 

<b>#import "TOTouchUIView.h"</b>

@interface TOViewController : UIViewController
<b>&lt; TOTouchUIViewDelegate &gt;</b>

<b>@property ( nonatomic , strong ) TOTouchUIView * touchView;</b>

@end
</pre>
<p>In the above we imported our new “<b>TOTouchUIView</b>” header file and then set our View / ViewController as a our touch view delegate by adding this line of code “<b>&lt; TOTouchUIViewDelegate &gt;</b>”.  Next we declared our view with the type TOTouchUIView.  Thats it! Just three lines of code.</p>
<p>OK, now let’s see how to finish this up in our views implementation file.   View the lines of code below to see, in bold, how we can finish adding our new UIView.</p>
<p></br></p>
<p><span class="subTitleGreenSmall">YourViewController.m</span></p>
<pre>
//
//  TOViewController.m
//  TouchOutside
//
//  Created by Kellen Styler on 9/19/11.
//  Copyright (c) 2011 Mine. All rights reserved.
//

#import "TOViewController.h"

@implementation TOViewController

#pragma mark - Synthesize
<b>@synthesize touchView;</b>

- (void)didReceiveMemoryWarning
    { [super didReceiveMemoryWarning]; }

#pragma mark - View lifecycle

- (void)viewDidLoad
    {
        [super viewDidLoad]; 

        // Set Up touchView
	   <b>touchView = [[TOTouchUIView alloc ] initWithFrame:CGRectMake( ( self.view.frame.size.width - 150 ) / 2 , ( self.view.frame.size.height - 150 ) / 2, 150 , 150 ) ];
        [self.view addSubview:touchView ];
        [touchView setDelegate:self ];</b>
    }

- (void)viewDidUnload
    { [super viewDidUnload]; }

- (void)viewWillAppear:(BOOL)animated
    { [super viewWillAppear:animated]; }

- (void)viewDidAppear:(BOOL)animated
    { [super viewDidAppear:animated]; }

- (void)viewWillDisappear:(BOOL)animated
    { [super viewWillDisappear:animated]; }

- (void)viewDidDisappear:(BOOL)animated
    { [super viewDidDisappear:animated]; }

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    { return YES; } 

#pragma mark - TOTouchUIView Delegate Methods 

<b>- (void) uiViewTouched:(BOOL)wasInside
    {
        if( wasInside )
            // Your code for inside touches...
        else
            // Your code for outside touches...
    }</b>

@end
</pre>
<p>OK, one last recap.</p>
<p>We synthesized our new <b>touchView</b> property so that we could access it in our implementation file.  Then within the “<b>viewDidLoad</b>” method we added touchView and set its delegate to <b>self</b>.  Remember we set our view controller as a TOTouchUIViewDelegate?  Now we can add the “<b>uiViewTouched</b>” delegate method so we can do something every time the user touches either inside or outside of our views bounds.</p>
<p>Done!</p>
<p class="subTitleContent"><span class="subTitle">^Need an Example?</span></p>
<p class="pageDivide">
<p>That was a lot to go through so here is an example I put together for you to play with.  Just click the button below.</p>
<p><a class="icon-button download-icon" href="http://www.kellenstyler.com/wp-content/posts/iOSTouchesOutside/TouchOutside.zip"><span class="et-icon"><span>Download Example</span></span></a></p>
]]></content:encoded>
			<wfw:commentRss>http://kellenstyler.com/index.php/2011/09/20/adding-touchoutside-functionality-to-a-uiview-in-ios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickly reverse ordered collections in Objective-C with reverseObjectEnumerator</title>
		<link>http://kellenstyler.com/index.php/2011/09/16/quickly-reverse-ordered-collections-in-objective-c-with-reverseobjectenumerator/</link>
		<comments>http://kellenstyler.com/index.php/2011/09/16/quickly-reverse-ordered-collections-in-objective-c-with-reverseobjectenumerator/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 15:10:37 +0000</pubDate>
		<dc:creator>flakeskstyle</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[NSArray]]></category>
		<category><![CDATA[NSMutableArray]]></category>

		<guid isPermaLink="false">http://kellenstyler.com/?p=1566</guid>
		<description><![CDATA[H ere is a quick and easy way to reverse an ordered collection in Objective-C. NSArrays / NSMutableArrays orderedCollection = [[orderedCollection reverseObjectEnumerator ] allObjects ]; Tying that into a method for ease of use - (NSArray * ) reverseArray:(NSArray * )withArray { return [[withArray reverseObjectEnumerator ] allObjects ]; }]]></description>
			<content:encoded><![CDATA[<p class="pageDivide">
<p><span style="font-size: 32px; color:rgba(215, 89, 76, 0.5);">H</span> ere is a quick and easy way to reverse an ordered collection in Objective-C.</p>
<p></br></p>
<p><span class="subTitleGreenSmall">NSArrays / NSMutableArrays</span></p>
<pre>
orderedCollection = [[orderedCollection reverseObjectEnumerator ] allObjects ];
</pre>
<p><span id="more-1566"></span></p>
<p><span class="subTitleGreenSmall">Tying that into a method for ease of use</span></p>
<pre>
- (NSArray * ) reverseArray:(NSArray * )withArray
    {
        return [[withArray reverseObjectEnumerator ] allObjects ];
    }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kellenstyler.com/index.php/2011/09/16/quickly-reverse-ordered-collections-in-objective-c-with-reverseobjectenumerator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improve performance with Fast Enumeration</title>
		<link>http://kellenstyler.com/index.php/2011/09/16/objective-c-tip-improve-performance-with-fast-enumeration/</link>
		<comments>http://kellenstyler.com/index.php/2011/09/16/objective-c-tip-improve-performance-with-fast-enumeration/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 04:09:22 +0000</pubDate>
		<dc:creator>flakeskstyle</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Fast Enumeration]]></category>
		<category><![CDATA[NSArray]]></category>
		<category><![CDATA[NSDictionary]]></category>
		<category><![CDATA[NSMutableArray]]></category>
		<category><![CDATA[NSMutableDictionary]]></category>
		<category><![CDATA[NSMutableSet]]></category>
		<category><![CDATA[NSSet]]></category>

		<guid isPermaLink="false">http://kellenstyler.com/?p=1485</guid>
		<description><![CDATA[F ast Enumeration is one of those gems in Objective-C that can be easily missed unless someone points it out to you. In fact, I just learned more about it a few months ago from a co-worker explained block methods for collections. I had been using it all along but I did not know as [...]]]></description>
			<content:encoded><![CDATA[<p class="pageDivide">
<p><span style="font-size: 32px; color:rgba(215, 89, 76, 0.5);">F</span> ast Enumeration is one of those gems in Objective-C that can be easily missed unless someone points it out to you.  In fact, I just learned more about it a few months ago from a co-worker explained block methods for collections.  I had been using it all along but I did not know as much about what goes on in the background.   As it turns out Fast Enumeration provides much better performance when running through collections and is much less verbose.  Win-Win for me!</p>
<p class="subTitleContent"><span class="subTitle">^OK, so what is Fast Enumeration?</span></p>
<p class="pageDivide">
<p>At a high level, Apple introduced the a Fast Enumeration back in iOS 2 and it was built on the NSFastEnumeration protocol.   This allowed iOS to then use pointer arithmetic as it enumerated, counted, over collections.  It ended up being much faster and removed the need to run method based calls against each object of a collection, iteratively, as a for statement would have.</p>
<p>There are a few ways to use Fast Enumeration within iOS.  The two that I prefer to use are the for/in loop and Block Enumeration.  The for/in loop is great because it uses the least amount of syntax and is great for simple tasks.  Then if you need something a little more complex while enumerating, the collection block methods step in to pick up the slack by providing more context for each object.</p>
<p>Lets start taking a look at the code.</p>
<p><span id="more-1485"></span></p>
<p class="subTitleContent"><span class="subTitle">^The for/in loop</span></p>
<p class="pageDivide">
<pre>
for( id obj in collection )
	// your code for each object
</pre>
<p>As you can see the for/in loop is very simple and would be perfect for running small amounts of code on each object in a collection.</p>
<p class="subTitleContent"><span class="subTitle">^Block Enumeration Methods</span></p>
<p class="pageDivide">
<p>Apple added Block Enumeration methods to collections when iOS 4 was introduced.  Look through the examples below to see the benefits that each method provides for it’s collection type.</p>
<p></br></p>
<p><span class="subTitleGreenSmall">NSArray Enumeration Blocks</span></p>
<pre>
[NSArray enumerateObjectsAtIndexes:(NSIndexSet *)
         options:(NSEnumerationOptions)
         usingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
	// Your code here...
} ]; 

------------

[NSArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop){
	// Your code here...
} ];

------------

[NSArray enumerateObjectsWithOptions:(NSEnumerationOptions)
         usingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
	// Your code here...
} ];
</pre>
<p><span class="subTitleGreenSmall">NSSet Enumeration Blocks</span></p>
<pre>
[NSSet enumerateObjectsUsingBlock:^(id obj, BOOL *stop) {
	// Your code here...
} ];

------------ 

[NSSet enumerateObjectsWithOptions:(NSEnumerationOptions)#
       usingBlock:^(id obj, BOOL *stop) {
	// Your code here...
} ];
</pre>
<p><span class="subTitleGreenSmall">NSDictionary Enumeration Blocks</span></p>
<pre>
[NSDictionary enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
	// Your code here...
} ];

------------

[NSDictionary enumerateKeysAndObjectsWithOptions:(NSEnumerationOptions)
              usingBlock:^(id key, id obj, BOOL *stop) {
	      // Your code here...
} ];
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kellenstyler.com/index.php/2011/09/16/objective-c-tip-improve-performance-with-fast-enumeration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

