<?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>farp.blog &#187; code</title>
	<atom:link href="http://fredandrandall.com/blog/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://fredandrandall.com/blog</link>
	<description>Bloggin&#039; about whatever</description>
	<lastBuildDate>Tue, 04 Nov 2014 07:15:30 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.38</generator>
	<item>
		<title>Afternoon Apps: Captionator</title>
		<link>http://fredandrandall.com/blog/2012/08/20/afternoon-apps-captionator/</link>
		<comments>http://fredandrandall.com/blog/2012/08/20/afternoon-apps-captionator/#comments</comments>
		<pubDate>Mon, 20 Aug 2012 04:47:19 +0000</pubDate>
		<dc:creator><![CDATA[Randall]]></dc:creator>
				<category><![CDATA[Afternoon Apps]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coregraphics]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[quartzcore]]></category>

		<guid isPermaLink="false">http://fredandrandall.com/blog/?p=752</guid>
		<description><![CDATA[A couple weeks ago, a friend of mine showed me the app I&#8217;d Cap That. After making some hilarious pictures, and after a few drinks, I made the claim that I could probably clone the app in a couple of &#8230; <a href="http://fredandrandall.com/blog/2012/08/20/afternoon-apps-captionator/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://fredandrandall.com/blog/wp-content/uploads/2012/08/photo-3.jpg"><img class="alignleft size-medium wp-image-756" title="Captionator" src="http://fredandrandall.com/blog/wp-content/uploads/2012/08/photo-3-300x225.jpg" alt="" width="300" height="225" /></a>A couple weeks ago, a friend of mine showed me the app <a href="http://itunes.apple.com/us/app/id-cap-that/id510544616?mt=8">I&#8217;d Cap That</a>. After making some hilarious pictures, and after a few drinks, I made the claim that I could probably clone the app in a couple of hours.</p>
<p>So the other day, that&#8217;s what I tried to do. The app is very simple. It takes a randomly generated caption and burns it on to an image. You can pick an image from your camera or your library.</p>
<p>When I wrote the BD&#8217;s Mongolian BBQ app, I took stamps and burned them onto an image to create funny mustache pictures. The way I did that was to position UIImageViews inside of a UIView and then render the view to an image. That strategy works fine, but it also drops the image resolution down quite a bit. (It will be whatever the size of the view is)</p>
<p>So this time, I decided to render the text directly onto the image by hand. This involves getting a graphics context, drawing the image into it, then drawing the text into it, and finally getting the resulting UIImage from the graphics context.</p>
<p>My first approach was to use a UILabel to render the text onto the image. That would take care of all the font sizing issues and save some code. This worked great, until I had white text on a light image. There&#8217;s a couple ways to solve this problem like putting a stroke around the text or adding a shadow to the text. I&#8217;d Cap That uses a shadow. I decided to go for a more meme style look and stroke the text.</p>
<p>Unfortunately, UILabel doesn&#8217;t support adding a stroke around the text. So I looked for some classes online that might get the job done. I found a couple, but they didn&#8217;t work like I wanted. Luckily, CoreGraphics lets you draw stroked text, you just have to handle more by yourself.</p>
<pre class="brush: objc; title: ; notranslate">
-(UIImage*)getImage:(UIImage*)image withCaption:(NSString*)captionString
{
   UIGraphicsBeginImageContext([image size]);
   [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];

   CGFloat captionFontSize = 300;
   CGSize captionSize = [captionString sizeWithFont:[UIFont boldSystemFontOfSize:captionFontSize]];

   while( captionSize.width &gt; image.size.width )
   {
      captionFontSize -= 5;
      captionSize = [captionString sizeWithFont:[UIFont boldSystemFontOfSize:captionFontSize]];
   }

   CGRect captionRect = CGRectMake((image.size.width - captionSize.width)/2.0, (image.size.height * .95)-captionSize.height, captionSize.width, captionSize.height);

   CGContextRef context = UIGraphicsGetCurrentContext();
   CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
   CGContextSetStrokeColorWithColor(context, [UIColor blackColor].CGColor);
   CGContextSetLineWidth(context, 3.0f);
   CGContextSetTextDrawingMode(context, kCGTextFillStroke);

   [captionString drawInRect:captionRect withFont:[UIFont boldSystemFontOfSize:captionFontSize]];

   UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext();

   UIGraphicsEndImageContext();
   return outputImage;
}
</pre>
<p>The problem with rendering the text yourself is that you need to size the font yourself. The way I&#8217;m doing it is picking a large font size (300 in this case) then measuring it and adjusting the font size until it fits on the image. There&#8217;s likely a better way, but this works and is fast enough.</p>
<p>I haven&#8217;t decided if I&#8217;m gonna release this app or not, like I did with my other <a title="Afternoon Apps: Descrumbled" href="http://fredandrandall.com/blog/2011/11/06/afternoon-apps-descrumbled/">Afternoon</a> <a title="Afternoon Apps 2: Scrumbled" href="http://fredandrandall.com/blog/2011/11/21/afternoon-apps-2-scrumbled/">Apps</a>. I have the <a href="https://github.com/blladnar/Captionator">source code up on GitHub</a> though, so feel free to take a look and use whatever you want from it.</p>
<p>There&#8217;s some issues with it. The camera view doesn&#8217;t work quite right. There aren&#8217;t any icons. One little feature in there is you can add to the list of captions. Of course the real secret sauce of I&#8217;d Cap That isn&#8217;t the app, it&#8217;s the hilarious captions.</p>
]]></content:encoded>
			<wfw:commentRss>http://fredandrandall.com/blog/2012/08/20/afternoon-apps-captionator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Afternoon Apps: Descrumbled</title>
		<link>http://fredandrandall.com/blog/2011/11/06/afternoon-apps-descrumbled/</link>
		<comments>http://fredandrandall.com/blog/2011/11/06/afternoon-apps-descrumbled/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 02:39:00 +0000</pubDate>
		<dc:creator><![CDATA[Randall]]></dc:creator>
				<category><![CDATA[Afternoon Apps]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone SDK]]></category>

		<guid isPermaLink="false">http://fredandrandall.com/blog/?p=650</guid>
		<description><![CDATA[At events like Startup Weekend, you try to build an idea in a weekend. I wanted to see if I could do something even faster. So I bring you Afternoon Apps, where I build an app in a single afternoon. &#8230; <a href="http://fredandrandall.com/blog/2011/11/06/afternoon-apps-descrumbled/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://fredandrandall.com/blog/wp-content/uploads/2011/11/DescrumbledLogo1.png"><img class="alignleft size-full wp-image-654" title="DescrumbledLogo" src="http://fredandrandall.com/blog/wp-content/uploads/2011/11/DescrumbledLogo1.png" alt="" width="198" height="60" /></a>At events like Startup Weekend, you try to build an idea in a weekend. I wanted to see if I could do something even faster. So I bring you <a href="http://fredandrandall.com/blog/category/afternoon-apps/">Afternoon Apps</a>, where I build an app in a single afternoon.</p>
<p><a href="http://descrumbled.com">Descrumbled</a> is an app for solving Boggle puzzles. Boggle is a word game where you have to find words hidden in a grid of letters. The app lets you enter a board and quickly generate all possible words that can be found in the puzzle. It uses the <a href="http://en.wikipedia.org/wiki/SOWPODS">SOWPODS</a> dictionary to see if a word is valid or not.</p>
<p>I was able to build the app in an afternoon because it is very simple. It lets you pick two board sizes, 4&#215;4 and 5&#215;5. Then you can enter the board, press solve, and seconds later you get a list of all the words. Pressing a word will give you the definition thanks to iOS 5&#8217;s dictionary integration.</p>
<p>The hard part was actually solving the puzzle. Generating all the possible words in the puzzle and checking them against a 230,000 word dictionary is no trivial task. I&#8217;m going to let you in on a little secret. I didn&#8217;t write the boggle solver in a single afternoon. I had written it before by working on it a few hours a day for 3 or so days. It was a programming challenge I found online and I tried to do it. It&#8217;s actually a lot of fun solving a problem like this. I get to think about tries and binary searches. Things I haven&#8217;t actually had to think much about since college. My first stab at it took about 3 minutes to solve a 4&#215;4 puzzle. Since most online Boggle rounds are 1 or 2 minutes, this obviously wasn&#8217;t acceptable. I improved my algorithm and now it takes ~1 second to solve a 5&#215;5 puzzle.</p>
<p>So what did I actually do in an afternoon? I built a UI around my boggle solver class. I had to get a C++ class working on the iPhone (which is actually really easy) and build a UI for entering the board. The squares on the board auto advance the cursor through a grid of UITextFields. It also makes sure the board is complete before it tries to solve. Then I had to make a way to clear the board and switch between a 4&#215;4 grid and a 5&#215;5 grid. The word list UI is just a very simple UITableView. When you press a row, it will open up the definition of the word in a UIReferenceLibraryViewController (new in iOS 5).</p>
<p>That&#8217;s it. The app is meant to be simple and easy to use. It really is a <a href="http://en.wikipedia.org/wiki/Minimum_viable_product">minimum viable product</a>. I did this as an exercise to see if I could build a simple app and submit it to the app store in an afternoon. I want to keep doing these Afternoon Apps every few weeks. I&#8217;d love to see if other people have done similar things and find out how your experience went.</p>
<p>The app should be live any day now. <a href="http://descrumbled.com">Check it out!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://fredandrandall.com/blog/2011/11/06/afternoon-apps-descrumbled/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Building a static library that works on the iPhone and the simulator</title>
		<link>http://fredandrandall.com/blog/2011/10/22/building-a-static-library-that-works-on-the-iphone-and-the-simulator/</link>
		<comments>http://fredandrandall.com/blog/2011/10/22/building-a-static-library-that-works-on-the-iphone-and-the-simulator/#comments</comments>
		<pubDate>Sat, 22 Oct 2011 15:03:15 +0000</pubDate>
		<dc:creator><![CDATA[Randall]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[objc]]></category>

		<guid isPermaLink="false">http://fredandrandall.com/blog/?p=629</guid>
		<description><![CDATA[Apple&#8217;s iPhone simulator runs really smooth and fast. This is because they aren&#8217;t emulating the ARM code on your Mac, they&#8217;re actually building x86 binaries that will run in the simulator. Because of this, code written for the iPhone needs &#8230; <a href="http://fredandrandall.com/blog/2011/10/22/building-a-static-library-that-works-on-the-iphone-and-the-simulator/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Apple&#8217;s iPhone simulator runs really smooth and fast. This is because they aren&#8217;t emulating the ARM code on your Mac, they&#8217;re actually building x86 binaries that will run in the simulator.</p>
<p>Because of this, code written for the iPhone needs to be compiled twice, once for the simulator and once for the device. This makes working with static libraries a bit of a pain, because you need two of them, one for each architecture.</p>
<p>Luckily, it&#8217;s possible to build a &#8220;universal&#8221; binary that will work with both architectures. Apple did this during their switch from PowerPC to Intel.<br />
<span id="more-629"></span></p>
<p>I found the directions in <a href="http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4">this StackOverflow post</a>.</p>
<p><a href="http://fredandrandall.com/blog/wp-content/uploads/2011/10/buildPhase.png"><img class="aligncenter size-full wp-image-633" title="buildPhase" src="http://fredandrandall.com/blog/wp-content/uploads/2011/10/buildPhase.png" alt="" width="877" height="443" /></a></p>
<ul>
<li>All you need to do is create a new static library target.</li>
<li>Add a &#8220;Run Script&#8221; build phase.</li>
<li>Copy and paste this script in.</li>
<li>Your build output should be in a folder labeled Debug_universal or Release_universal</li>
</ul>
<pre class="brush: bash; title: ; notranslate">
# Version 2.0 (updated for Xcode 4, with some fixes)
# Changes:
#    - Works with xcode 4, even when running xcode 3 projects (Workarounds for apple bugs)
#    - Faster / better: only runs lipo once, instead of once per recursion
#    - Added some debugging statemetns that can be switched on/off by changing the DEBUG_THIS_SCRIPT variable to &quot;true&quot;
#    - Fixed some typos
#
# Purpose:
#   Create a static library for iPhone from within XCode
#   Because Apple staff DELIBERATELY broke Xcode to make this impossible from the GUI (Xcode 3.2.3 specifically states this in the Release notes!)
#   ...no, I don't understand why they did this!
#
# Author: Adam Martin - http://twitter.com/redglassesapps
# Based on: original script from Eonil (main changes: Eonil's script WILL NOT WORK in Xcode GUI - it WILL CRASH YOUR COMPUTER)
#
# More info: see this Stack Overflow question: http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4

#################[ Tests: helps workaround any future bugs in Xcode ]########
#
DEBUG_THIS_SCRIPT=&quot;false&quot;

if [ $DEBUG_THIS_SCRIPT = &quot;true&quot; ]
then
echo &quot;########### TESTS #############&quot;
echo &quot;Use the following variables when debugging this script; note that they may change on recursions&quot;
echo &quot;BUILD_DIR = $BUILD_DIR&quot;
echo &quot;BUILD_ROOT = $BUILD_ROOT&quot;
echo &quot;CONFIGURATION_BUILD_DIR = $CONFIGURATION_BUILD_DIR&quot;
echo &quot;BUILT_PRODUCTS_DIR = $BUILT_PRODUCTS_DIR&quot;
echo &quot;CONFIGURATION_TEMP_DIR = $CONFIGURATION_TEMP_DIR&quot;
echo &quot;TARGET_BUILD_DIR = $TARGET_BUILD_DIR&quot;
fi

#####################[ part 1 ]##################
# First, work out the BASESDK version number (NB: Apple ought to report this, but they hide it)
#    (incidental: searching for substrings in sh is a nightmare! Sob)

SDK_VERSION=$(echo ${SDK_NAME} | grep -o '.\{3\}$')

# Next, work out if we're in SIM or DEVICE

if [ ${PLATFORM_NAME} = &quot;iphonesimulator&quot; ]
then
OTHER_SDK_TO_BUILD=iphoneos${SDK_VERSION}
else
OTHER_SDK_TO_BUILD=iphonesimulator${SDK_VERSION}
fi

echo &quot;XCode has selected SDK: ${PLATFORM_NAME} with version: ${SDK_VERSION} (although back-targetting: ${IPHONEOS_DEPLOYMENT_TARGET})&quot;
echo &quot;...therefore, OTHER_SDK_TO_BUILD = ${OTHER_SDK_TO_BUILD}&quot;
#
#####################[ end of part 1 ]##################

#####################[ part 2 ]##################
#
# IF this is the original invocation, invoke WHATEVER other builds are required
#
# Xcode is already building ONE target...
#
# ...but this is a LIBRARY, so Apple is wrong to set it to build just one.
# ...we need to build ALL targets
# ...we MUST NOT re-build the target that is ALREADY being built: Xcode WILL CRASH YOUR COMPUTER if you try this (infinite recursion!)
#
#
# So: build ONLY the missing platforms/configurations.

if [ &quot;true&quot; == ${ALREADYINVOKED:-false} ]
then
echo &quot;RECURSION: I am NOT the root invocation, so I'm NOT going to recurse&quot;
else
# CRITICAL:
# Prevent infinite recursion (Xcode sucks)
export ALREADYINVOKED=&quot;true&quot;

echo &quot;RECURSION: I am the root ... recursing all missing build targets NOW...&quot;
echo &quot;RECURSION: ...about to invoke: xcodebuild -configuration \&quot;${CONFIGURATION}\&quot; -target \&quot;${TARGET_NAME}\&quot; -sdk \&quot;${OTHER_SDK_TO_BUILD}\&quot; ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO&quot;
xcodebuild -configuration &quot;${CONFIGURATION}&quot; -target &quot;${TARGET_NAME}&quot; -sdk &quot;${OTHER_SDK_TO_BUILD}&quot; ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR=&quot;${BUILD_DIR}&quot; BUILD_ROOT=&quot;${BUILD_ROOT}&quot;

ACTION=&quot;build&quot;

#Merge all platform binaries as a fat binary for each configurations.

# Calculate where the (multiple) built files are coming from:
CURRENTCONFIG_DEVICE_DIR=${SYMROOT}/${CONFIGURATION}-iphoneos
CURRENTCONFIG_SIMULATOR_DIR=${SYMROOT}/${CONFIGURATION}-iphonesimulator

echo &quot;Taking device build from: ${CURRENTCONFIG_DEVICE_DIR}&quot;
echo &quot;Taking simulator build from: ${CURRENTCONFIG_SIMULATOR_DIR}&quot;

CREATING_UNIVERSAL_DIR=${SYMROOT}/${CONFIGURATION}-universal
echo &quot;...I will output a universal build to: ${CREATING_UNIVERSAL_DIR}&quot;

# ... remove the products of previous runs of this script
#      NB: this directory is ONLY created by this script - it should be safe to delete!

rm -rf &quot;${CREATING_UNIVERSAL_DIR}&quot;
mkdir &quot;${CREATING_UNIVERSAL_DIR}&quot;

#
echo &quot;lipo: for current configuration (${CONFIGURATION}) creating output file: ${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}&quot;
lipo -create -output &quot;${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}&quot; &quot;${CURRENTCONFIG_DEVICE_DIR}/${EXECUTABLE_NAME}&quot; &quot;${CURRENTCONFIG_SIMULATOR_DIR}/${EXECUTABLE_NAME}&quot;

#########
#
# Added: StackOverflow suggestion to also copy &quot;include&quot; files
#    (untested, but should work OK)
#
if [ -d &quot;${CURRENTCONFIG_DEVICE_DIR}/usr/local/include&quot; ]
then
mkdir -p &quot;${CREATING_UNIVERSAL_DIR}/usr/local/include&quot;
# * needs to be outside the double quotes?
cp &quot;${CURRENTCONFIG_DEVICE_DIR}/usr/local/include/&quot;* &quot;${CREATING_UNIVERSAL_DIR}/usr/local/include&quot;
fi
fi
</pre>
]]></content:encoded>
			<wfw:commentRss>http://fredandrandall.com/blog/2011/10/22/building-a-static-library-that-works-on-the-iphone-and-the-simulator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to change the color of UIBarButtonItem on iOS 5</title>
		<link>http://fredandrandall.com/blog/2011/10/15/how-to-change-the-color-of-uibarbuttonitem-on-ios-5/</link>
		<comments>http://fredandrandall.com/blog/2011/10/15/how-to-change-the-color-of-uibarbuttonitem-on-ios-5/#comments</comments>
		<pubDate>Sat, 15 Oct 2011 19:45:26 +0000</pubDate>
		<dc:creator><![CDATA[Randall]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[iOS 5]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[objc]]></category>

		<guid isPermaLink="false">http://fredandrandall.com/blog/?p=623</guid>
		<description><![CDATA[My most popular blog post is how to change the color of a UIBarButtonItem. It&#8217;s something that lots of people want to do, but it involved some pretty weird hacks to get it working. Now that iOS 5 is out, &#8230; <a href="http://fredandrandall.com/blog/2011/10/15/how-to-change-the-color-of-uibarbuttonitem-on-ios-5/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>My <a href="http://fredandrandall.com/blog/2011/03/31/how-to-change-the-color-of-a-uibarbuttonitem/" title="How to change the color of a UIBarButtonItem">most popular blog post</a> is how to change the color of a UIBarButtonItem. It&#8217;s something that lots of people want to do, but it involved some pretty weird hacks to get it working.</p>
<p>Now that iOS 5 is out, I can talk about a better way to do it. Apple will now let you set the <code>tintColor:</code> property on the bar button item. That&#8217;s it. No more weird hacks with images or segmented controls.</p>
<p>There&#8217;s even a cool new appearance proxy that will let you change all controls from your app with a single line of code. (More about UIAppearance <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIAppearance_Protocol/Reference/Reference.html">here</a>)</p>
<p>So lets say you want every UIBarButtonItem in your application to be blue. That&#8217;s easy just call <code>[UIBarButtonItem appearance] setTintColor:[UIColor blueColor]]</code></p>
<p>Remember, this is iOS 5 only. If you want your app to support iOS 4, you&#8217;ll have to do it <a href="http://fredandrandall.com/blog/2011/03/31/how-to-change-the-color-of-a-uibarbuttonitem/" title="How to change the color of a UIBarButtonItem">the old way</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://fredandrandall.com/blog/2011/10/15/how-to-change-the-color-of-uibarbuttonitem-on-ios-5/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Introducing: HappyCampfire, a Campfire framework for OS X and iOS</title>
		<link>http://fredandrandall.com/blog/2011/10/02/introducing-happycampfire-a-campfire-framework-for-os-x-and-ios/</link>
		<comments>http://fredandrandall.com/blog/2011/10/02/introducing-happycampfire-a-campfire-framework-for-os-x-and-ios/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 02:04:26 +0000</pubDate>
		<dc:creator><![CDATA[Randall]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[happycampfire]]></category>
		<category><![CDATA[happycampr]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://fredandrandall.com/blog/?p=548</guid>
		<description><![CDATA[One of my favorite tools that I use at work is Campfire. If you haven&#8217;t heard of Campfire, it&#8217;s a group chat web app built by 37 signals. It&#8217;s very easy to use and has some fun features. One day &#8230; <a href="http://fredandrandall.com/blog/2011/10/02/introducing-happycampfire-a-campfire-framework-for-os-x-and-ios/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://fredandrandall.com/blog/wp-content/uploads/2011/10/campfirelogo.png"><img class="alignleft size-medium wp-image-609" title="campfirelogo" src="http://fredandrandall.com/blog/wp-content/uploads/2011/10/campfirelogo-300x248.png" alt="" width="300" height="248" /></a>One of my favorite tools that I use at work is <a href="http://campfirenow.com/">Campfire</a>. If you haven&#8217;t heard of Campfire, it&#8217;s a group chat web app built by 37 signals. It&#8217;s very easy to use and has some fun features. One day I started playing around with the Campfire API to see what could be done and from that came the app I&#8217;m working on called HappyCampr. From that app, came the framework HappyCampfire.</p>
<p><a href="https://github.com/blladnar/HappyCamprFramework">HappyCampfire</a> is an objective-c wrapper around most of the Campfire API. It has model objects like users, messages, and rooms. It should allow anyone familiar with Cocoa programming to get right to work on using the Campfire API. It is designed to work on both OS X and iOS but most of the work/testing has been on OS X.</p>
<p>I wanted to put this out there to help people make good innovative uses of Campfire, without having to deal with too many of the nitty gritty details. It&#8217;s definitely still a bit of a work in progress so feel free to fork it and send me a pull request if want to fix/add anything.<span id="more-548"></span></p>
<p>The framework is designed to be asynchronous and uses <a href="http://allseeing-i.com/ASIHTTPRequest/">ASIHTTPRequest</a> for the network communication. It also allows you to make use of Campfire&#8217;s streaming API to get message updates. The project includes a test app for OS X that will let you test all of the different parts of the framework.</p>
<p>To get started you&#8217;ll create an object like this</p>
<pre class="brush: objc; title: ; notranslate">
campfire = [[HappyCampfire alloc] initWithCampfireURL:@&quot;https://YOUR_CAMPFIRE_URL.campfirenow.com&quot;];
campfire.authToken = @&quot;YOUR_AUTH_TOKEN&quot;;

[campfire sendText:@&quot;Hello World&quot; toRoom:@&quot;ROOM_NUM&quot; completionHandler:^(HCMessage *message, NSError *error){

   NSLog(@&quot;%@&quot;, message);

}];
</pre>
<p>If you&#8217;re interested in using the streaming API that&#8217;s really easy too.</p>
<pre class="brush: objc; title: ; notranslate">

campfire.delegate = self;
[campfire startListeningForMessagesInRoom:@&quot;ROOM_NUMBER&quot;];

// Then you'll implement the CampfireResponseProtocol
-(void)messageReceived:(HCMessage *)message
{
   NSLog(@&quot;Message: %@&quot;, message);
}
</pre>
<p><a href="https://github.com/blladnar/HappyCamprFramework/">Check it out on GitHub</a></p>
]]></content:encoded>
			<wfw:commentRss>http://fredandrandall.com/blog/2011/10/02/introducing-happycampfire-a-campfire-framework-for-os-x-and-ios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make your app open in full screen on Lion</title>
		<link>http://fredandrandall.com/blog/2011/09/08/how-to-make-your-app-open-in-full-screen-on-lion/</link>
		<comments>http://fredandrandall.com/blog/2011/09/08/how-to-make-your-app-open-in-full-screen-on-lion/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 02:37:03 +0000</pubDate>
		<dc:creator><![CDATA[Randall]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[fullscreen]]></category>
		<category><![CDATA[lion]]></category>
		<category><![CDATA[objc]]></category>

		<guid isPermaLink="false">http://fredandrandall.com/blog/?p=540</guid>
		<description><![CDATA[One of Lions new features is full screen apps. Full screening an app is supposed to remove all distractions and make room for more of the app&#8217;s UI. Actually implementing this in your app is quite simple, but finding how &#8230; <a href="http://fredandrandall.com/blog/2011/09/08/how-to-make-your-app-open-in-full-screen-on-lion/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://fredandrandall.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-08-at-10.21.08-PM.png"><img class="alignleft size-full wp-image-543" title="Screen Shot 2011-09-08 at 10.21.08 PM" src="http://fredandrandall.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-08-at-10.21.08-PM.png" alt="" width="77" height="75" /></a>One of Lions new features is full screen apps. Full screening an app is supposed to remove all distractions and make room for more of the app&#8217;s UI. Actually implementing this in your app is quite simple, but finding how to do it online can be a bit tricky.</p>
<p>There are two ways to do it, one is with NSApplication and the other is with NSWindow.</p>
<p>To do it with NSApplication, you&#8217;ll make this simple call</p>
<pre class="brush: objc; title: ; notranslate">
   [[NSApplication sharedApplication]
           setPresentationOptions:NSFullScreenWindowMask];
</pre>
<p>To do it with NSWindow you&#8217;ll make this one</p>
<pre class="brush: objc; title: ; notranslate">
   [window setCollectionBehavior:
             NSWindowCollectionBehaviorFullScreenPrimary];
</pre>
<p>There is also an <code>NSWindowCollectionBehaviorFullScreenAuxiliary</code> that you can use to allow auxiliary windows to show up in the space with the main window.</p>
<p>Calling either of these methods will add the resize button to the upper right corner of the window. You can call them at any time also. If you want it to be in the app all the time, call it somewhere like <code>applicationDidFinishLaunching</code>.</p>
<p>One thing to remember is that fullscreen functionality like this is LION ONLY. If you&#8217;re using this in an app that targets more than 10.7, make sure to do the appropriate checks around this code.</p>
]]></content:encoded>
			<wfw:commentRss>http://fredandrandall.com/blog/2011/09/08/how-to-make-your-app-open-in-full-screen-on-lion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Automatic Link Detection in an NSTextView</title>
		<link>http://fredandrandall.com/blog/2011/08/16/automatic-link-detection-in-an-nstextview/</link>
		<comments>http://fredandrandall.com/blog/2011/08/16/automatic-link-detection-in-an-nstextview/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 03:48:19 +0000</pubDate>
		<dc:creator><![CDATA[Randall]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[NSTextView]]></category>
		<category><![CDATA[objc]]></category>

		<guid isPermaLink="false">http://fredandrandall.com/blog/?p=506</guid>
		<description><![CDATA[NSTextView is a really powerful text view class. It can do all kinds of stuff like automatic spelling correction, email, phone number, and address detection, and link detection. I was working on a chat application and I wanted to have &#8230; <a href="http://fredandrandall.com/blog/2011/08/16/automatic-link-detection-in-an-nstextview/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>NSTextView is a really powerful text view class. It can do all kinds of stuff like automatic spelling correction, email, phone number, and address detection, and link detection. I was working on a chat application and I wanted to have links that people sent be clickable. I was using an NSTextView because it has the automaticLinkDetection property.</p>
<p>Unfortunately, I couldn&#8217;t get links to show up in my app. I tried sending it delegate messages and lots of other stuff. It just wouldn&#8217;t work when I set the text programatically. It would only work when I was actually typing in to the NSTextView and even then, it was a little flaky. I posted a <a href="http://stackoverflow.com/questions/7055131/automatic-link-detection-not-working-in-nstextview-after-programmatically-setting">question on StackOverflow</a> and didn&#8217;t get any answers.</p>
<p>So to fix the problem, I did the link detection myself. I look through the text view for links and then add them myself as NSAttributedStrings. I did this using three different categories.</p>
<p>There is <a href="http://snippets.aktagon.com/snippets/358-How-to-make-a-clickable-link-inside-a-NSTextField-and-Cocoa">NSAttributedString+Hyperlink</a>, NSString+FindURLs, and NSTextView+AutomaticLinkDetection. I use the FindURLs category to find the links and their locations, then I use the Hyperlink category to format the string like a link, and the AutomaticLinkDetection category to bring them together.</p>
<p>You use it like this</p>
<pre class="brush: objc; title: ; notranslate">
   [myTextView setString:@&quot;http://google.com http://apple.com&quot;];
   [myTextView detectAndAddLinks];
</pre>
<p>And here is the implementation</p>
<pre class="brush: objc; title: ; notranslate">
-(void)detectAndAddLinks
{
   NSArray *linkLocations = [[self string] locationsOfLinks];
   NSArray *links = [[self string] arrayOfLinks];

   int i=0;
   for( NSString *link in links )
   {
      NSAttributedString *linkString = [NSAttributedString hyperlinkFromString:link withURL:[NSURL URLWithString:link]];
      [[self textStorage] replaceCharactersInRange:[[linkLocations objectAtIndex:i] range] withAttributedString:linkString];
      i++;
   }

}
</pre>
<p>I put an <a href="https://github.com/blladnar/AutoLink">example project on GitHub</a> that you can look at and use.</p>
<p>Let me know if there was something I missed that would make it so I don&#8217;t have to use the category.</p>
]]></content:encoded>
			<wfw:commentRss>http://fredandrandall.com/blog/2011/08/16/automatic-link-detection-in-an-nstextview/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to change the color of a UIBarButtonItem</title>
		<link>http://fredandrandall.com/blog/2011/03/31/how-to-change-the-color-of-a-uibarbuttonitem/</link>
		<comments>http://fredandrandall.com/blog/2011/03/31/how-to-change-the-color-of-a-uibarbuttonitem/#comments</comments>
		<pubDate>Thu, 31 Mar 2011 23:12:08 +0000</pubDate>
		<dc:creator><![CDATA[Randall]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[objc]]></category>
		<category><![CDATA[UIBarButtonItem]]></category>
		<category><![CDATA[UISegmentedControl]]></category>

		<guid isPermaLink="false">http://fredandrandall.com/blog/?p=310</guid>
		<description><![CDATA[EDIT: There is a new way to do this in iOS 5 that is much easier and nicer. If you want to support iOS 4, keep reading. A UIBarButtonItem is an item that goes on a UIToolbar or a UINavigationBar. &#8230; <a href="http://fredandrandall.com/blog/2011/03/31/how-to-change-the-color-of-a-uibarbuttonitem/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://fredandrandall.com/blog/wp-content/uploads/2011/03/UIBarButtonItemTint.png"><img class="alignleft size-medium wp-image-316" title="UIBarButtonItemTint" src="http://fredandrandall.com/blog/wp-content/uploads/2011/03/UIBarButtonItemTint-154x300.png" alt="" width="154" height="300" /></a></p>
<p><strong>EDIT: There is a <a title="How to change the color of UIBarButtonItem on iOS 5" href="http://fredandrandall.com/blog/2011/10/15/how-to-change-the-color-of-uibarbuttonitem-on-ios-5/">new way to do this</a> in iOS 5 that is much easier and nicer. If you want to support iOS 4, keep reading.</strong></p>
<p>A UIBarButtonItem is an item that goes on a UIToolbar or a UINavigationBar. It&#8217;s typically a button but it can be a bunch of different things. I&#8217;m going to talk about the button. A UIBarButtonItem button takes on the color of the bar that it is on. You can set the tint of a UIToolbar, but you can&#8217;t change the colors of the buttons on it.</p>
<p>I found lots of different solutions for this online, most involving adding a UIButton as the customView of the UIBarButtonItem and having some sort of image for the color you need. That works fine, until you need a color that you don&#8217;t have an image for.</p>
<p>I found a better solution <a href="http://charles.lescampeurs.org/2011/02/10/tint-color-uibutton-and-uibarbuttonitem">here</a>. Basically what they figured out was that a UISegmentedControl with a style of UISegmentedControlStyleBar looks just like a UIBarButtonItem. A key difference is that UISegmentedControl has a nice <a href="http://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UISegmentedControl_Class/Reference/UISegmentedControl.html#//apple_ref/occ/instp/UISegmentedControl/tintColor">tintColor</a> property that you can use to change the colors.</p>
<p>So what I did was take <a href="https://github.com/CharlyBr/MrBrown-Blob">CharlyBr</a>&#8216;s code and put it into a UIBarButtonItem category.</p>
<pre class="brush: objc; title: ; notranslate">
+(UIBarButtonItem*)barButtonItemWithTint:(UIColor*)color andTitle:(NSString*)itemTitle andTarget:(id)theTarget andSelector:(SEL)selector
{
	UISegmentedControl *button = [[[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:itemTitle, nil]] autorelease];
	button.momentary = YES;
	button.segmentedControlStyle = UISegmentedControlStyleBar;
	button.tintColor = color;
	[button addTarget:theTarget action:selector forControlEvents:UIControlEventValueChanged];

	UIBarButtonItem *removeButton = [[[UIBarButtonItem alloc] initWithCustomView:button] autorelease];

	return removeButton;
}
</pre>
<p>You can check out my example project on <a href="https://github.com/blladnar/UIBarButtonItem-Tint">GitHub</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://fredandrandall.com/blog/2011/03/31/how-to-change-the-color-of-a-uibarbuttonitem/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Simple imgur iPhone Uploader</title>
		<link>http://fredandrandall.com/blog/2011/02/26/simple-imgur-iphone-uploader/</link>
		<comments>http://fredandrandall.com/blog/2011/02/26/simple-imgur-iphone-uploader/#comments</comments>
		<pubDate>Sat, 26 Feb 2011 23:01:27 +0000</pubDate>
		<dc:creator><![CDATA[Randall]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[imgur]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[objc]]></category>
		<category><![CDATA[uploader]]></category>

		<guid isPermaLink="false">http://fredandrandall.com/blog/?p=259</guid>
		<description><![CDATA[Recently I&#8217;ve been toying with the idea of adding image uploading to Thoughtback. One easy way to do that is to use another image host and just post a link in the thought. I decided to try out imgur because &#8230; <a href="http://fredandrandall.com/blog/2011/02/26/simple-imgur-iphone-uploader/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://fredandrandall.com/blog/wp-content/uploads/2011/02/imgurimage.png"><img class="alignleft size-full wp-image-275" title="imgurimage" src="http://fredandrandall.com/blog/wp-content/uploads/2011/02/imgurimage.png" alt="" width="333" height="134" /></a>Recently I&#8217;ve been toying with the idea of adding image uploading to <a href="http://www.thoughtback.com">Thoughtback</a>. One easy way to do that is to use another image host and just post a link in the thought. I decided to try out <a href="http://www.imgur.com">imgur</a> because of their <a href="http://api.imgur.com/resources_anon">Anonymous API</a>. What it lets you do is upload images to their service, without requiring a username and password. This is great if you just want quick and easy image sharing.</p>
<p>To get started imgur has some good <a href="http://api.imgur.com/examples">examples</a> of how to upload in a variety of programming languages. I grabbed the iPhone example and copy and pasted it in thinking, &#8220;Well that was easy&#8221;. It turns out there was a little bit more to do.</p>
<p><span id="more-259"></span>Here is the iOS example from their website (with a few typos corrected)</p>
<pre class="brush: objc; title: ; notranslate">
-(NSData *)uploadPhoto:(UIImage *) image {
       NSData   *imageData  = UIImageJPEGRepresentation(image,1);
       NSString *imageB64   = [self escapeString:[imageData base64Encoding]];  //Custom implementations, no built in base64 or HTTP escaping for iPhone
       NSString *uploadCall = [NSStringstringWithFormat:@&quot;key=%@ℑ=%@&quot;,imgurKey,imageB64];

       NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@&quot;http://api.imgur.com/2/upload&quot;]];
       [request setHTTPMethod:@&quot;POST&quot;];
       [request setValue:[NSString stringWithFormat:@&quot;%d&quot;,[uploadCalllength]] forHTTPHeaderField:@&quot;Content-length&quot;];
       [request setHTTPBody:[uploadCall dataUsingEncoding:NSUTF8StringEncoding]];

       NSURLResponse *response;
       NSError *error = nil;

       NSData *XMLResponse= [NSURLConnection sendSynchronousRequest:requestreturningResponse:&amp;response error:&amp;error];

       return XMLResponse;
}
</pre>
<p>The problem with their example was that it wasn&#8217;t quite finished.<br />
<a href="http://fredandrandall.com/blog/wp-content/uploads/2011/02/apiProblem1.png"><img class="aligncenter size-full wp-image-267" title="apiProblem" src="http://fredandrandall.com/blog/wp-content/uploads/2011/02/apiProblem1.png" alt="" width="614" height="60" /></a>That <code>Database64Encoding</code> method is not a part of the iOS sdk. You need to do that yourself. So what does it mean exactly?</p>
<p>It means that you need to convert the image data to <a href="http://en.wikipedia.org/wiki/Base64">Base64</a>. That basically means turning your image data into a string so it can be sent up via a POST request. So I did a little bit of Googling and found some code that converts NSData to a Base64 NSString. I got the code from the <a href="http://mattgemmell.com/2008/02/22/mgtwitterengine-twitter-from-cocoa">MGTwitterEngine</a>, but it can be found in a few places.</p>
<p>So after that I thought I should be done. I ran the code and got an error back from imgur. Then I noticed the weird ℑ character in the request. I&#8217;m not sure what it&#8217;s for, but it didn&#8217;t work. I replaced it with &#8220;image&#8221; and I got a success back from imgur.</p>
<p>Hooray, everything seemed like it was working, but it still wasn&#8217;t. When I went to the URL in the response, there was no image. Nothing loaded. What was wrong?</p>
<p>I had a suspicion that there was some funny stuff going on with the encoding so I wrote the base64 encoded string out to a file (it was waaaay too long for NSLog to handle) to see what was actually in it. There were a bunch of /&#8217;s and +&#8217;s. These are valid URL characters that can definitely mess up query string parsing if you want them to be in one of your arguments.</p>
<p>I pulled out an NSString category I had written to escape valid URL characters and called my <code>stringByEscapingValidURLCharacters</code> method on the base64 string. After trying again I was getting valid stuff back and my image URLs were loading correctly.</p>
<p>So, to prevent others from going through the headaches to make a simple imgur uploader, I decided to open source some example code code.</p>
<p>This code is very simplistic. It is a simple iPhone app that lets you choose an image from the camera or your phone&#8217;s library and send it to imgur. The ImgurUploader class calls out to imgur and returns the URL of the original sized image by calling a delegate method. It doesn&#8217;t handle any errors right now either. You will also need to get an <a href="http://imgur.com/register/api/">API key</a> from imgur, which only takes a second. This comes with the &#8220;works on my machine&#8221; <a href="http://www.codinghorror.com/blog/2007/03/the-works-on-my-machine-certification-program.html">seal</a> of approval.</p>
<p><a href="https://github.com/blladnar/iPhone-Imgur-Uploader">Check it out on GitHub</a></p>
]]></content:encoded>
			<wfw:commentRss>http://fredandrandall.com/blog/2011/02/26/simple-imgur-iphone-uploader/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to create a custom cocoa framework</title>
		<link>http://fredandrandall.com/blog/2011/02/04/how-to-create-a-custom-cocoa-framework/</link>
		<comments>http://fredandrandall.com/blog/2011/02/04/how-to-create-a-custom-cocoa-framework/#comments</comments>
		<pubDate>Sat, 05 Feb 2011 04:29:53 +0000</pubDate>
		<dc:creator><![CDATA[Randall]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[objc]]></category>
		<category><![CDATA[thoughtback]]></category>

		<guid isPermaLink="false">http://fredandrandall.com/blog/?p=238</guid>
		<description><![CDATA[I was recently trying to rip out some code from the Thoughtback app into it&#8217;s own framework so that I could eventually open source when we decide to make our API public. I&#8217;ve used frameworks plenty of times, but I&#8217;ve never &#8230; <a href="http://fredandrandall.com/blog/2011/02/04/how-to-create-a-custom-cocoa-framework/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I was recently trying to rip out some code from the <a href="http://www.thoughtback.com">Thoughtback</a> app into it&#8217;s own framework so that I could eventually open source when we decide to make our API public. I&#8217;ve used frameworks plenty of times, but I&#8217;ve never actually made my own.</p>
<p>I started off by just using the default Cocoa Framework project that XCode makes for you. It all seemed to work just fine, but when I tried actually using the framework in a different project, it wouldn&#8217;t load. I kept getting this error</p>
<pre class="brush: plain; title: ; notranslate">Library not loaded: path/to/framework
 Referenced from: path/to/app/
 Reason: image not found</pre>
<p><span id="more-238"></span>After lots of looking around I finally figured out the problem. Frameworks can be referenced at the System level (requires admin rights to install), the User level (could be useful to share a framework between apps), and at the application level. Bundling your framework inside the application is the most common way to do that. The &#8220;image not found&#8221; error has to do with some pathing in the framework. To fix it, you&#8217;ll need to change the &#8220;Installation Directory&#8221; in the build settings of your framework. Right click on your framework&#8217;s target to bring up the info panel. Search for &#8220;Installation Directory&#8221; and set it to be <strong>@executable_path/../Frameworks</strong>.</p>
<p><a href="http://fredandrandall.com/blog/wp-content/uploads/2011/02/InstallationDirectory.png"><img class="aligncenter size-full wp-image-248" title="InstallationDirectory" src="http://fredandrandall.com/blog/wp-content/uploads/2011/02/InstallationDirectory.png" alt="" width="516" height="593" /></a></p>
<p>Now the framework should load just fine in any project you want to use it in. I still had a problem though. If you&#8217;re familiar with cocoa frameworks, you&#8217;ll know its just a bundle with a library and some header files in a certain directory structure. I looked at my framework and couldn&#8217;t find the &#8220;Headers&#8221; folder with my header files so I couldn&#8217;t use anything that was in my framework. I googled around for a little while and found nothing. Thats when I noticed the &#8220;Role&#8221; column when I clicked on my framework target. That let me set the header files to public, private, or project, depending on how I wanted them to show up in my framework.</p>
<p><a href="http://fredandrandall.com/blog/wp-content/uploads/2011/02/PublicHeader.png"><img class="aligncenter size-full wp-image-247" title="PublicHeader" src="http://fredandrandall.com/blog/wp-content/uploads/2011/02/PublicHeader.png" alt="" width="370" height="401" /></a></p>
<p>So now that I have the library path right and the header files right, there is just one thing I needed to do to get it working in my test app. You&#8217;ll need to add another build step to your application target that copies the framework to your application bundle.</p>
<ol>
<li>Right click on your application target.</li>
<li>Click &#8220;New Build Phase&#8221;</li>
<li>Click &#8220;New Copy Files Build Phase&#8221;</li>
<li>Change the destination to &#8220;Frameworks&#8221;</li>
<li>Close the window.</li>
<li>Drag and drop your framework into the build phase.</li>
</ol>
<p><object id="scPlayer" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="763" height="429" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="data" value="http://content.screencast.com/users/lladnar/folders/Jing/media/33d932c2-955a-4b9b-841e-236f5ce936e8/jingswfplayer.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" /><param name="flashVars" value="thumb=http://content.screencast.com/users/lladnar/folders/Jing/media/33d932c2-955a-4b9b-841e-236f5ce936e8/FirstFrame.jpg&amp;containerwidth=763&amp;containerheight=429&amp;content=http://content.screencast.com/users/lladnar/folders/Jing/media/33d932c2-955a-4b9b-841e-236f5ce936e8/00000074.swf&amp;blurover=false" /><param name="allowFullScreen" value="true" /><param name="scale" value="showall" /><param name="allowScriptAccess" value="always" /><param name="base" value="http://content.screencast.com/users/lladnar/folders/Jing/media/33d932c2-955a-4b9b-841e-236f5ce936e8/" /><param name="src" value="http://content.screencast.com/users/lladnar/folders/Jing/media/33d932c2-955a-4b9b-841e-236f5ce936e8/jingswfplayer.swf" /><param name="flashvars" value="thumb=http://content.screencast.com/users/lladnar/folders/Jing/media/33d932c2-955a-4b9b-841e-236f5ce936e8/FirstFrame.jpg&amp;containerwidth=763&amp;containerheight=429&amp;content=http://content.screencast.com/users/lladnar/folders/Jing/media/33d932c2-955a-4b9b-841e-236f5ce936e8/00000074.swf&amp;blurover=false" /><param name="allowfullscreen" value="true" /><embed id="scPlayer" type="application/x-shockwave-flash" width="763" height="429" src="http://content.screencast.com/users/lladnar/folders/Jing/media/33d932c2-955a-4b9b-841e-236f5ce936e8/jingswfplayer.swf" base="http://content.screencast.com/users/lladnar/folders/Jing/media/33d932c2-955a-4b9b-841e-236f5ce936e8/" allowscriptaccess="always" scale="showall" allowfullscreen="true" flashvars="thumb=http://content.screencast.com/users/lladnar/folders/Jing/media/33d932c2-955a-4b9b-841e-236f5ce936e8/FirstFrame.jpg&amp;containerwidth=763&amp;containerheight=429&amp;content=http://content.screencast.com/users/lladnar/folders/Jing/media/33d932c2-955a-4b9b-841e-236f5ce936e8/00000074.swf&amp;blurover=false" bgcolor="#FFFFFF" quality="high" data="http://content.screencast.com/users/lladnar/folders/Jing/media/33d932c2-955a-4b9b-841e-236f5ce936e8/jingswfplayer.swf"></embed></object></p>
<p>Hopefully you found this useful. I couldn&#8217;t find all of the resources I needed in one place and what I did find wasn&#8217;t detailed enough to solve my problem immediately. This <a href="http://www.cimgf.com/2008/09/04/cocoa-tutorial-creating-your-very-own-framework/">post</a> from Cocoa Is My Girlfriend got me most of the way there and has some more good information on the subject.</p>
]]></content:encoded>
			<wfw:commentRss>http://fredandrandall.com/blog/2011/02/04/how-to-create-a-custom-cocoa-framework/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
