<?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>Perceive Designs &#187; Objective-C</title>
	<atom:link href="http://www.perceive.net/category/programming/objective-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.perceive.net</link>
	<description>My Perception is My Reality</description>
	<lastBuildDate>Wed, 30 Nov 2011 19:06:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Finally Found the Error I&#8217;ve Been Looking for (or &#8220;OSX Error Code Lookup Tool&#8221;)</title>
		<link>http://www.perceive.net/2009/12/22/finally-found-the-error-ive-been-looking-for-or-osx-error-code-lookup-tool/</link>
		<comments>http://www.perceive.net/2009/12/22/finally-found-the-error-ive-been-looking-for-or-osx-error-code-lookup-tool/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 19:29:25 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://www.perceive.net/?p=1071</guid>
		<description><![CDATA[In a recent project, I kept receiving a -10000 error in the console when running my app.  Quite frustrating to say the least since the error description was useless, and Google wasn&#8217;t any help at all either.
So I was completely thrilled to come across the OSX Error Code Lookup Tool.  Download, compile, and plug in [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent project, I kept receiving a -10000 error in the console when running my app.  Quite frustrating to say the least since the error description was useless, and Google wasn&#8217;t any help at all either.</p>
<p>So I was completely thrilled to come across the <a href="http://bitbucket.org/boredzo/error-lookup-tool/downloads/" onclick="javascript:pageTracker._trackPageview('/outbound/article/bitbucket.org');">OSX Error Code Lookup Tool</a>.  Download, compile, and plug in your error code &#8212; it&#8217;ll give you something good back!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.perceive.net/2009/12/22/finally-found-the-error-ive-been-looking-for-or-osx-error-code-lookup-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Color Me Crazy (or &#8220;When a Color Isn&#8217;t Just a Color&#8221;)</title>
		<link>http://www.perceive.net/2009/11/19/color-me-crazy-or-when-a-color-isnt-just-a-color/</link>
		<comments>http://www.perceive.net/2009/11/19/color-me-crazy-or-when-a-color-isnt-just-a-color/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 18:04:47 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[cocoatouch]]></category>
		<category><![CDATA[UIColor]]></category>
		<category><![CDATA[UIImage]]></category>

		<guid isPermaLink="false">http://www.perceive.net/?p=1037</guid>
		<description><![CDATA[Ever need to use an image as a background, but can&#8217;t figure out how?  It&#8217;s quite simple &#8212; colors aren&#8217;t always colors:

UIImage *patternImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"patternImage" ofType:@"png"]];

[myView setBackgroundColor:[UIColor colorWithPatternImage: patternImage]];

]]></description>
			<content:encoded><![CDATA[<p>Ever need to use an image as a background, but can&#8217;t figure out how?  It&#8217;s quite simple &#8212; colors aren&#8217;t always colors:</p>
<pre><code>
UIImage *patternImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"patternImage" ofType:@"png"]];

[myView setBackgroundColor:[UIColor colorWithPatternImage: patternImage]];
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.perceive.net/2009/11/19/color-me-crazy-or-when-a-color-isnt-just-a-color/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>We are a Billion Fragments (or &#8220;Removing URL Fragments with NSURL&#8221;)</title>
		<link>http://www.perceive.net/2009/11/19/we-are-a-billion-fragments-or-removing-url-fragments-with-nsurl/</link>
		<comments>http://www.perceive.net/2009/11/19/we-are-a-billion-fragments-or-removing-url-fragments-with-nsurl/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 17:24:35 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[NSURL]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.perceive.net/?p=1059</guid>
		<description><![CDATA[NSURL is a wonderfully powerful Cocoa object, bet there is at least one thing it leaves out, but I'll show you how to fix that.]]></description>
			<content:encoded><![CDATA[<p>NSURL is a wonderfully powerful Cocoa object, bet there is at least one thing it leaves out, but I&#8217;ll show you how to fix that.  <a href="http://en.wikipedia.org/wiki/Uniform_Resource_Locator"title="Uniform Resource Locator"  onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');">URLs</a> are composed of several distinct parts. Given the example URL of http://www.example.com:80/path/to/file/page.htm?key=val#foo this is broken into these parts:</p>
<ul>
<li>scheme (http://)</li>
<li>authority (www.example.com:80)</li>
<li>path (/path/to/file/page.htm)</li>
<li>query (key=val)</li>
<li>fragment (foo)</li>
</ul>
<p>You can read more about all of this in <a href="http://labs.apache.org/webarch/uri/rfc/rfc3986.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/labs.apache.org');">RFC3986</a>.  Today I&#8217;m just focusing on the fragment part.</p>
<p>Frequently, you have an NSURL object and may just want the URL without the fragment, to find distinct pages in a site for example.</p>
<p>This Objective-C category on the NSURL object does just that.</p>
<p>header:</p>
<pre>//
//  PDNSURLExtras.h
//
//  Created by Eric Vitiello on 11/5/09.
//  Copyright 2009 Eric Vitiello. All rights reserved.
//

#import 

@interface NSURL (PDExtras)
- (NSURL *)urlByRemovingFragment;
@end</pre>
<p>implementation:</p>
<pre>//
//  PDNSURLExtras.m
//
//  Created by Eric Vitiello on 11/5/09.
//  Copyright 2009 Eric Vitiello. All rights reserved.
//

#import "PDNSURLExtras.h"

@implementation NSURL (PDExtras)

-(NSURL *)urlByRemovingFragment {
	NSString *urlString = [self absoluteString];
	// Find that last component in the string from the end to make sure to get the last one
	NSRange fragmentRange = [urlString rangeOfString:@"#" options:NSBackwardsSearch];
	if (fragmentRange.location != NSNotFound) {
		// Chop the fragment.
		NSString* newURLString = [urlString substringToIndex:fragmentRange.location];
		return [NSURL URLWithString:newURLString];
	} else {
		return self;
	}
}

@end</pre>
<p>To use:</p>
<pre>NSURL *url = [NSURL URLWithString:@"http://www.example.com:80/path/to/file/page.htm?key=val#foo"];
NSURL *urlWithoutFragment = [url urlByRemovingFragment];</pre>
<p>Nice and simple.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.perceive.net/2009/11/19/we-are-a-billion-fragments-or-removing-url-fragments-with-nsurl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>If I Had a Photograph of You (or &#8220;How to Cache Images in CocoaTouch&#8221;)</title>
		<link>http://www.perceive.net/2009/01/13/if-i-had-a-photograph-of-you-or-how-to-cache-images-in-cocoatouch/</link>
		<comments>http://www.perceive.net/2009/01/13/if-i-had-a-photograph-of-you-or-how-to-cache-images-in-cocoatouch/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 02:44:44 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.perceive.net/?p=1035</guid>
		<description><![CDATA[A quick note.  Wanting to cache images in an iPhone app?  Load the image using:
[UIImage imageNamed:]
if you use:
[UIImage imageWithContentsOfFile:]
the image will not be cached.
]]></description>
			<content:encoded><![CDATA[<p>A quick note.  Wanting to cache images in an iPhone app?  Load the image using:</p>
<pre>[UIImage imageNamed:]</pre>
<p>if you use:</p>
<pre>[UIImage imageWithContentsOfFile:]</pre>
<p>the image will not be cached.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.perceive.net/2009/01/13/if-i-had-a-photograph-of-you-or-how-to-cache-images-in-cocoatouch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

