<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Using NSScanner to convert Hex to RGB Color</title>
	<atom:link href="http://MobileDeveloperTips.com/general/using-nsscanner-to-convert-hex-to-rgb-color.html/feed" rel="self" type="application/rss+xml" />
	<link>http://MobileDeveloperTips.com/general/using-nsscanner-to-convert-hex-to-rgb-color.html</link>
	<description>iOS and Objective-C Tips, Tricks and Tutorials.</description>
	<lastBuildDate>Sat, 19 May 2012 05:15:17 -0500</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Hcan</title>
		<link>http://MobileDeveloperTips.com/general/using-nsscanner-to-convert-hex-to-rgb-color.html#comment-56637</link>
		<dc:creator>Hcan</dc:creator>
		<pubDate>Tue, 26 Jul 2011 09:17:31 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=1604#comment-56637</guid>
		<description>Thanks for sharing this. Its a nice compact way of doing the stuff</description>
		<content:encoded><![CDATA[<p>Thanks for sharing this. Its a nice compact way of doing the stuff</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hcan</title>
		<link>http://MobileDeveloperTips.com/general/using-nsscanner-to-convert-hex-to-rgb-color.html#comment-56636</link>
		<dc:creator>Hcan</dc:creator>
		<pubDate>Tue, 26 Jul 2011 09:16:28 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=1604#comment-56636</guid>
		<description>Thanks, this is very useful.</description>
		<content:encoded><![CDATA[<p>Thanks, this is very useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonas Schnelli</title>
		<link>http://MobileDeveloperTips.com/general/using-nsscanner-to-convert-hex-to-rgb-color.html#comment-18494</link>
		<dc:creator>Jonas Schnelli</dc:creator>
		<pubDate>Thu, 01 Jul 2010 20:12:27 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=1604#comment-18494</guid>
		<description>Here&#039;s an open source UIColor category / extension to make hex color creation from NSString possible:
http://github.com/jonasschnelli/UIColor-i7HexColor</description>
		<content:encoded><![CDATA[<p>Here&#8217;s an open source UIColor category / extension to make hex color creation from NSString possible:<br />
<a href="http://github.com/jonasschnelli/UIColor-i7HexColor" rel="nofollow">http://github.com/jonasschnelli/UIColor-i7HexColor</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://MobileDeveloperTips.com/general/using-nsscanner-to-convert-hex-to-rgb-color.html#comment-5172</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Wed, 23 Sep 2009 05:17:22 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=1604#comment-5172</guid>
		<description>This is my technique:

#define HEXCOLOR(c) [UIColor colorWithRed:((c)&amp;0xFF)/255.0 \
									green:((c&gt;&gt;8)&amp;0xFF)/255.0 \
									blue:((c&gt;&gt;16)&amp;0xFF)/255.0 \
									alpha:((c&gt;&gt;24)&amp;0xFF)/255.0]
unsigned int colorValue;
[[NSScanner scannerWithString:colorString] scanHexInt:&amp;colorValue];
UIColor *color = HEXCOLOR(colorValue);	

A sample hex color string &quot;7fcf0064&quot; that should come out as light purple.  &quot;64&quot; is red and &quot;7f&quot; is alpha.</description>
		<content:encoded><![CDATA[<p>This is my technique:</p>
<p>#define HEXCOLOR(c) [UIColor colorWithRed:((c)&amp;0xFF)/255.0 \<br />
									green:((c&gt;&gt;8)&amp;0xFF)/255.0 \<br />
									blue:((c&gt;&gt;16)&amp;0xFF)/255.0 \<br />
									alpha:((c&gt;&gt;24)&amp;0xFF)/255.0]<br />
unsigned int colorValue;<br />
[[NSScanner scannerWithString:colorString] scanHexInt:&amp;colorValue];<br />
UIColor *color = HEXCOLOR(colorValue);	</p>
<p>A sample hex color string &#8220;7fcf0064&#8243; that should come out as light purple.  &#8220;64&#8243; is red and &#8220;7f&#8221; is alpha.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://MobileDeveloperTips.com/general/using-nsscanner-to-convert-hex-to-rgb-color.html#comment-3668</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Wed, 01 Jul 2009 00:12:01 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=1604#comment-3668</guid>
		<description>This is good. Should you want something even more complex have a look at this: http://paste.lisp.org/display/74985</description>
		<content:encoded><![CDATA[<p>This is good. Should you want something even more complex have a look at this: <a href="http://paste.lisp.org/display/74985" rel="nofollow">http://paste.lisp.org/display/74985</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ed</title>
		<link>http://MobileDeveloperTips.com/general/using-nsscanner-to-convert-hex-to-rgb-color.html#comment-2374</link>
		<dc:creator>Ed</dc:creator>
		<pubDate>Mon, 25 May 2009 03:33:11 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=1604#comment-2374</guid>
		<description>Thank you.  This was useful and well presented.</description>
		<content:encoded><![CDATA[<p>Thank you.  This was useful and well presented.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AJS</title>
		<link>http://MobileDeveloperTips.com/general/using-nsscanner-to-convert-hex-to-rgb-color.html#comment-275</link>
		<dc:creator>AJS</dc:creator>
		<pubDate>Thu, 05 Mar 2009 17:09:53 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=1604#comment-275</guid>
		<description>Ok, so I should have finished coding before replying here. It seems that the iPhone doesn&#039;t support sRGB when going via CGColor: kCGColorSpaceSRGB is unavailable.</description>
		<content:encoded><![CDATA[<p>Ok, so I should have finished coding before replying here. It seems that the iPhone doesn&#8217;t support sRGB when going via CGColor: kCGColorSpaceSRGB is unavailable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AJS</title>
		<link>http://MobileDeveloperTips.com/general/using-nsscanner-to-convert-hex-to-rgb-color.html#comment-274</link>
		<dc:creator>AJS</dc:creator>
		<pubDate>Thu, 05 Mar 2009 16:24:26 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=1604#comment-274</guid>
		<description>Also note that the UIColor convenience constructor used above interprets the RGBA values in the device colorspace. This differs from the hex strings in CSS which are in sRGB.

To use sRGB it looks like one has to go via CGColor.</description>
		<content:encoded><![CDATA[<p>Also note that the UIColor convenience constructor used above interprets the RGBA values in the device colorspace. This differs from the hex strings in CSS which are in sRGB.</p>
<p>To use sRGB it looks like one has to go via CGColor.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rodney Aiglstorfer</title>
		<link>http://MobileDeveloperTips.com/general/using-nsscanner-to-convert-hex-to-rgb-color.html#comment-270</link>
		<dc:creator>Rodney Aiglstorfer</dc:creator>
		<pubDate>Sun, 01 Mar 2009 20:19:16 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=1604#comment-270</guid>
		<description>@Joao Prado Maia

Thanks for that tip ... it is much more concise.  Unfortunately it doesn&#039;t deal with the issue that I was solving.  In my case, the hex value was stored in a text file as a string.  This file was something that was created by an entirely different application (thus no control over format).  Given that the rgbvalue was a string, NSScanner made the most sense.  All that said, I will definitely use your approach if I have a hex value in an integer value.</description>
		<content:encoded><![CDATA[<p>@Joao Prado Maia</p>
<p>Thanks for that tip &#8230; it is much more concise.  Unfortunately it doesn&#8217;t deal with the issue that I was solving.  In my case, the hex value was stored in a text file as a string.  This file was something that was created by an entirely different application (thus no control over format).  Given that the rgbvalue was a string, NSScanner made the most sense.  All that said, I will definitely use your approach if I have a hex value in an integer value.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan</title>
		<link>http://MobileDeveloperTips.com/general/using-nsscanner-to-convert-hex-to-rgb-color.html#comment-268</link>
		<dc:creator>Ivan</dc:creator>
		<pubDate>Sun, 01 Mar 2009 14:53:23 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=1604#comment-268</guid>
		<description>Rodney,

Thanks, this is very helpful.

Cheers,
Ivan</description>
		<content:encoded><![CDATA[<p>Rodney,</p>
<p>Thanks, this is very helpful.</p>
<p>Cheers,<br />
Ivan</p>
]]></content:encoded>
	</item>
</channel>
</rss>

