<?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>Software Warlock &#187; iPhone</title>
	<atom:link href="http://softwareblog.morlok.net/category/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://softwareblog.morlok.net</link>
	<description></description>
	<lastBuildDate>Sat, 24 Dec 2011 16:06:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>TTStyledText problems with ampersand (&#8216;&amp;&#8217;)</title>
		<link>http://softwareblog.morlok.net/2010/04/25/ttstyledtext-problems-with-ampersand/</link>
		<comments>http://softwareblog.morlok.net/2010/04/25/ttstyledtext-problems-with-ampersand/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 18:50:34 +0000</pubDate>
		<dc:creator>Warlock</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://softwareblog.morlok.net/?p=338</guid>
		<description><![CDATA[I ran across an interesting problem today where I was trying to use TTStyledText from the Three20 project to create a TTStyledTextLabel that had text with links nested within it. I was trying to Map here. I was doing this &#8230;<p class="read-more"><a href="http://softwareblog.morlok.net/2010/04/25/ttstyledtext-problems-with-ampersand/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>I ran across an interesting problem today where I was trying to use TTStyledText from the <a href="http://github.com/facebook/three20">Three20</a> project to create a TTStyledTextLabel that had text with links nested within it.  I was trying to</p>
<p>Map <a href="http://maps.google.com/maps?f=q&#038;hl=en&#038;geocode=&#038;time=&#038;date=&#038;ttype=&#038;q=1850+N.+White+Bear+Ave+Maplewood+MN+55109&#038;sll=37.0625,-95.677068&#038;sspn=44.60973,72.509766&#038;ie=UTF8&#038;ll=44.996854,-93.025103&#038;spn=0.039087,0.07081&#038;z=14&#038;om=1">here</a>.</p>
<p>I was doing this with the following (simplified code):</p>
<pre name="code" class="objc">
[TTStyledText textFromXHTML:@"Map &lt;a href=\"http://www.google.com/maps?f=q&#038;hl=en\">here&lt;/a>." lineBreaks:YES URLs:YES];
</pre>
<p>As soon as I tried to put a URL in that had multiple URL parameters (and thus an &amp;) things would disappear.</p>
<p>From briefly looking at the Three20 source code, I believe this because the parsing of the XHTML text is being done with an XML parser.  As soon as I replaced the &amp;s with &amp;amp;s things started to work.  This can be done using the following code:</p>
<pre name="code" class="objc">
[@"Map &lt;a href=\"http://www.google.com/maps?f=q&#038;hl=en\">here&lt;/a>." stringByReplacingOccurrencesOfString:@"&#038;" withString:@"&amp;amp;"];
</pre>
]]></content:encoded>
			<wfw:commentRss>http://softwareblog.morlok.net/2010/04/25/ttstyledtext-problems-with-ampersand/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Cocoa/UIKit BulbView</title>
		<link>http://softwareblog.morlok.net/2009/06/18/cocoauikit-bulbview/</link>
		<comments>http://softwareblog.morlok.net/2009/06/18/cocoauikit-bulbview/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 05:35:56 +0000</pubDate>
		<dc:creator>Warlock</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[CoreGraphics]]></category>
		<category><![CDATA[Quartz 2D]]></category>
		<category><![CDATA[scoreboard]]></category>

		<guid isPermaLink="false">http://softwareblog.morlok.net/?p=281</guid>
		<description><![CDATA[In my continuing saga to bring old-school displays to new-school (word?) devices, I&#8217;ve created a &#8220;bulb view&#8221; that displays characters in a grid of &#8220;lights&#8221;. The best way to describe it is probably just to see it: Like previous LCD &#8230;<p class="read-more"><a href="http://softwareblog.morlok.net/2009/06/18/cocoauikit-bulbview/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://softwareblog.morlok.net/2009/05/25/cocoa-lcd-screen-view/">continuing saga</a> to bring old-school displays to new-school (word?) devices, I&#8217;ve created a &#8220;bulb view&#8221; that displays characters in a grid of &#8220;lights&#8221;.  The best way to describe it is probably just to see it:</p>
<div id="attachment_284" class="wp-caption aligncenter" style="width: 310px"><a href="http://softwareblog.morlok.net/wp-content/uploads/2009/06/picture-3.png"><img src="http://softwareblog.morlok.net/wp-content/uploads/2009/06/picture-3-300x64.png" alt="BulbView from Mac" title="BulbView from Mac" width="300" height="64" class="size-medium wp-image-284" /></a><p class="wp-caption-text">BulbView from Mac</p></div>
<div id="attachment_283" class="wp-caption aligncenter" style="width: 310px"><a href="http://softwareblog.morlok.net/wp-content/uploads/2009/06/picture-4.png"><img src="http://softwareblog.morlok.net/wp-content/uploads/2009/06/picture-4-300x161.png" alt="BulbView on iPhone" title="BulbView on iPhone" width="300" height="161" class="size-medium wp-image-283" /></a><p class="wp-caption-text">BulbView on iPhone</p></div>
<p>Like previous <a href="http://softwareblog.morlok.net/2009/05/25/cocoa-lcd-screen-view/">LCD view</a> you can set the colors for the lit &amp; dim bulbs, but improved from the LCD view, you can use letters, numbers, and most punctuation/special characters.  Again the rendering is done in pure Quartz2D.</p>
<p>The source, including demo apps for both the Mac and iPhone, can be found <a href="http://github.com/rmorlok/BulbView/tree">here</a>. With this view I was smart and made it conditionally compile various parts so that it can be used on either the iPhone or the Mac, without needing separate files.</p>
]]></content:encoded>
			<wfw:commentRss>http://softwareblog.morlok.net/2009/06/18/cocoauikit-bulbview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Conditional Compilation for iPhone</title>
		<link>http://softwareblog.morlok.net/2009/06/17/conditional-compilation-for-iphone/</link>
		<comments>http://softwareblog.morlok.net/2009/06/17/conditional-compilation-for-iphone/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 04:31:52 +0000</pubDate>
		<dc:creator>Warlock</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[conditional compilation]]></category>

		<guid isPermaLink="false">http://softwareblog.morlok.net/?p=278</guid>
		<description><![CDATA[I&#8217;m working on a view right now that I want to be able to cross compile as either an NSView for the Mac, or a UIVIew for the iPhone. I originally wrote it for Leopard, but now I&#8217;m trying to &#8230;<p class="read-more"><a href="http://softwareblog.morlok.net/2009/06/17/conditional-compilation-for-iphone/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a view right now that I want to be able to cross compile as either an NSView for the Mac, or a UIVIew for the iPhone.  I originally wrote it for Leopard, but now I&#8217;m trying to add the precompiler directives to let it cross compile between the two platforms.  A quick Google search didn&#8217;t reveal anything, here are the possible definitions you can use:</p>
<pre name="code" class="c">
#define __MAC_10_0      1000
#define __MAC_10_1      1010
#define __MAC_10_2      1020
#define __MAC_10_3      1030
#define __MAC_10_4      1040
#define __MAC_10_5      1050
#define __MAC_10_6      1060
#define __MAC_NA        9999   /* not available */

#define __IPHONE_2_0     20000
#define __IPHONE_2_1     20100
#define __IPHONE_2_2     20200
#define __IPHONE_3_0     30000
#define __IPHONE_NA      99999  /* not available */
</pre>
<p>This definition comes from Availability.h located at <tt>/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/Availability.h</tt> (for the iPhone 3.0 SDK).</p>
<p>Obviously, the <tt>__MAC_10_x</tt> is actually for the version of OSX, and the <tt>__IPHONE_x_x</tt> is for iPhone.</p>
<p>So, if you wanted to have code conditionally compile for the iPhone (assuming 3.0 SDK) you would do something like the following:</p>
<pre name="code" class="c">
#ifdef __IPHONE_3_0
    // iPhone
    #import &lt;UIKit/UIKit.h&gt;
#else
    // Mac
    #import &lt;Cocoa/Cocoa.h&gt;
#endif
</pre>
]]></content:encoded>
			<wfw:commentRss>http://softwareblog.morlok.net/2009/06/17/conditional-compilation-for-iphone/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

