<?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>Cayden Liew</title>
	<atom:link href="http://caydenliew.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://caydenliew.com</link>
	<description>When you think it&#039;s impossible</description>
	<lastBuildDate>Thu, 26 Jan 2012 11:50:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Customize UISearchBar Background Image</title>
		<link>http://caydenliew.com/2012/01/customize-uisearchbar-background-image/</link>
		<comments>http://caydenliew.com/2012/01/customize-uisearchbar-background-image/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 11:50:47 +0000</pubDate>
		<dc:creator>cayden</dc:creator>
				<category><![CDATA[IOS]]></category>
		<category><![CDATA[iPhone Tutorial]]></category>
		<category><![CDATA[Customize UISearchBar]]></category>
		<category><![CDATA[UISearchBar]]></category>
		<category><![CDATA[UISearchBar background image]]></category>

		<guid isPermaLink="false">http://caydenliew.com/?p=231</guid>
		<description><![CDATA[In this post, I&#8217;ll walkthrough how to customize the background of UISearchBar. In order to customize the UISearchBar, first we need to know it&#8217;s subviews. We can get the subviews by running the code below: for &#40;UIView *subview in &#91;searchBar subviews&#93;&#41; &#123; NSLog&#40;@&#34;%@&#34;, &#91;subview class&#93;&#41;; &#125; If you run the code above, and you are running IOS 4.3 and above, you should see two subviews &#8220;UISearchBarBackground&#8221; and &#8220;UISearchBarTextField&#8221;. So, we know that UISearchBar consist of [...]]]></description>
			<content:encoded><![CDATA[<p>In this post, I&#8217;ll walkthrough how to customize the background of UISearchBar.</p>
<p>In order to customize the UISearchBar, first we need to know it&#8217;s subviews. We can get the subviews by running the code below:
</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>UIView <span style="color: #339933;">*</span>subview in <span style="color: #009900;">&#91;</span>searchBar subviews<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        NSLog<span style="color: #009900;">&#40;</span>@<span style="color: #ff0000;">&quot;%@&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span>subview class<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>If you run the code above, and you are running IOS 4.3 and above, you should see two subviews &#8220;UISearchBarBackground&#8221; and &#8220;UISearchBarTextField&#8221;. So, we know that UISearchBar consist of a background view and a textfield, that make sense.</p>
<p><a href="http://caydenliew.com/wp-content/uploads/2012/01/default-uisearchbar.png"><img src="http://caydenliew.com/wp-content/uploads/2012/01/default-uisearchbar-300x27.png" alt="default-uisearchbar" title="default-uisearchbar" width="300" height="27" class="alignleft size-medium wp-image-232" /></a></p>
<p>The default UISearchBar looks like the screenshot above, so let&#8217;s try to remove the background and see how the UISearchBar will look like by running the code below:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>UIView <span style="color: #339933;">*</span>subview in <span style="color: #009900;">&#91;</span>searchBar subviews<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>subview isKindOfClass<span style="color: #339933;">:</span>NSClassFromString<span style="color: #009900;">&#40;</span>@<span style="color: #ff0000;">&quot;UISearchBarBackground&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #009900;">&#91;</span>subview removeFromSuperview<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The code is quite straight forward, it loop through all the subviews of UISearchBar and check if any subview belongs to the class &#8220;UISearchBarBackground&#8221;, if it is, remove it.</p>
<p>After you run the code, you should be able to see something like screenshot below. The background has been removed.</p>
<p><a href="http://caydenliew.com/wp-content/uploads/2012/01/uisearchbar-without-background.png"><img src="http://caydenliew.com/wp-content/uploads/2012/01/uisearchbar-without-background-300x26.png" alt="uisearchbar-without-background" title="uisearchbar-without-background" width="300" height="26" class="alignleft size-medium wp-image-233" /></a></p>
<p>Now we only left with the UITextfield, we can customize the UITexfield by running the code below:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>UIView <span style="color: #339933;">*</span>subview in <span style="color: #009900;">&#91;</span>searchBar subviews<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>subview isKindOfClass<span style="color: #339933;">:</span>NSClassFromString<span style="color: #009900;">&#40;</span>@<span style="color: #ff0000;">&quot;UISearchBarBackground&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #009900;">&#91;</span>subview removeFromSuperview<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>subview isKindOfClass<span style="color: #339933;">:</span>NSClassFromString<span style="color: #009900;">&#40;</span>@<span style="color: #ff0000;">&quot;UISearchBarTextField&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#40;</span>UITextField <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>subview setBackground<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;searchboxbg.png&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>The code above look for the UISearchBarTextField subview and set it&#8217;s background with our own image &#8220;searchboxbg.png&#8221;.</p>
<p>After running the code, you&#8217;ll see something like screenshot below.</p>
<p><a href="http://caydenliew.com/wp-content/uploads/2012/01/custom-uisearchbar.png"><img src="http://caydenliew.com/wp-content/uploads/2012/01/custom-uisearchbar-300x28.png" alt="custom-uisearchbar" title="custom-uisearchbar" width="300" height="28" class="alignleft size-medium wp-image-234" /></a></p>
<p>This is how you can customize the UISearchBar.</p>
]]></content:encoded>
			<wfw:commentRss>http://caydenliew.com/2012/01/customize-uisearchbar-background-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>O level POA iPhone App</title>
		<link>http://caydenliew.com/2012/01/o-level-poa-iphone-app/</link>
		<comments>http://caydenliew.com/2012/01/o-level-poa-iphone-app/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 04:26:40 +0000</pubDate>
		<dc:creator>cayden</dc:creator>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[IOS]]></category>
		<category><![CDATA[iPhone app]]></category>
		<category><![CDATA[O Level]]></category>
		<category><![CDATA[POA]]></category>
		<category><![CDATA[Principles of Accounts]]></category>

		<guid isPermaLink="false">http://caydenliew.com/?p=215</guid>
		<description><![CDATA[New iPhone app released on Chinese New Year, Jan 25, 2012. App name: O Level POA Description: Learn GCE &#8216;N&#8217; and &#8216;O&#8217; Level Principles of Accounts by reviewing the notes specially designed for Secondary 3, 4 and 5 students in Singapore. You will be able to read full notes of all topics and test yourself by attempting on at least 10 multiple-choiced questions per topic. Correct answers will be marked in green while wrong answers [...]]]></description>
			<content:encoded><![CDATA[<p style="margin:5px 0 5px 0"><a href="http://caydenliew.com/wp-content/uploads/2012/01/s1.jpg"><img src="http://caydenliew.com/wp-content/uploads/2012/01/s1-200x300.jpg" alt="" title="POA-1" width="200" height="300" class="alignleft size-medium wp-image-217" /></a></p>
<p>New iPhone app released on Chinese New Year, Jan 25, 2012.</p>
<p><b>App name: <a href="http://itunes.apple.com/us/app/o-level-poa/id494556980?ls=1&#038;mt=8" title="O Level POA" target="_blank">O Level POA</a></b></p>
<p><b>Description:</b></p>
<p>Learn GCE &#8216;N&#8217; and &#8216;O&#8217; Level Principles of Accounts by reviewing the notes specially designed for Secondary 3, 4 and 5 students in Singapore. </p>
<p>You will be able to read full notes of all topics and test yourself by attempting on at least 10 multiple-choiced questions per topic. </p>
<p>Correct answers will be marked in green while wrong answers will be highlighted in red. Users can also submit questions via the app to the author for clarifications. The author is a current school teacher from the Ministry of Education.</p>
<p style="margin:10px 0 10px 0">
<a href="http://caydenliew.com/wp-content/uploads/2012/01/s2.jpg"><img src="http://caydenliew.com/wp-content/uploads/2012/01/s2-200x300.jpg" alt="" title="POA-2" width="200" height="300" class="alignright size-medium wp-image-218" /></a>
</p>
<p style="margin:10px 0 10px 0">
<a href="http://caydenliew.com/wp-content/uploads/2012/01/s5.jpg"><img src="http://caydenliew.com/wp-content/uploads/2012/01/s5-200x300.jpg" alt="" title="POA-3" width="200" height="300" class="alignleft size-medium wp-image-219" /></a></p>
<p style="margin:10px 0 10px 0"><a href="http://caydenliew.com/wp-content/uploads/2012/01/s4.jpg"><img src="http://caydenliew.com/wp-content/uploads/2012/01/s4-200x300.jpg" alt="" title="POA-4" width="200" height="300" class="alignleft size-medium wp-image-222" /></a></p>
<p>You can download the app <a href="http://itunes.apple.com/us/app/o-level-poa/id494556980?ls=1&#038;mt=8" title="O Level POA" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://caydenliew.com/2012/01/o-level-poa-iphone-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UILabel With Different Style Text</title>
		<link>http://caydenliew.com/2012/01/uilabel-with-different-style-text/</link>
		<comments>http://caydenliew.com/2012/01/uilabel-with-different-style-text/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 02:27:14 +0000</pubDate>
		<dc:creator>cayden</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[IOS]]></category>
		<category><![CDATA[IOS Library]]></category>
		<category><![CDATA[iPhone Tutorial]]></category>
		<category><![CDATA[IOS font style]]></category>
		<category><![CDATA[ios tutorial]]></category>
		<category><![CDATA[iPhone tutorial]]></category>
		<category><![CDATA[NSAttributedStrings]]></category>
		<category><![CDATA[OHAttributedStrings]]></category>
		<category><![CDATA[UILabel]]></category>

		<guid isPermaLink="false">http://caydenliew.com/?p=204</guid>
		<description><![CDATA[There are situations when we need to style a UILabel differently for each text. This can be done by using NSAttributedStrings. Thanks to the library OHAttributedLabel, you can achieve the styled NSAttributedStrings easily under one UILabel. In order to use the library, you must first import the CoreText Framework. In the example below, I style the label so that the text are splited into 2 different colors. OHAttributedLabel *label; NSString *txt = @&#34;page (1 of [...]]]></description>
			<content:encoded><![CDATA[<p>There are situations when we need to style a UILabel differently for each text. This can be done by using NSAttributedStrings.
</p>
<p>
Thanks to the library <a href="https://github.com/AliSoftware/OHAttributedLabel#readme" title="OHAttributedLabel" target="_blank">OHAttributedLabel</a>, you can achieve the styled NSAttributedStrings easily under one UILabel.
</p>
<p>
In order to use the library, you must first import the CoreText Framework. In the example below, I style the label so that the text are splited into 2 different colors.
</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">    OHAttributedLabel <span style="color: #339933;">*</span>label<span style="color: #339933;">;</span>
    NSString <span style="color: #339933;">*</span>txt <span style="color: #339933;">=</span> @<span style="color: #ff0000;">&quot;page (1 of 10)&quot;</span><span style="color: #339933;">;</span>
    NSMutableAttributedString<span style="color: #339933;">*</span> attrStr <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>NSMutableAttributedString attributedStringWithString<span style="color: #339933;">:</span>txt<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    NSArray <span style="color: #339933;">*</span>splits <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>txt componentsSeparatedByString<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;(&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#91;</span>attrStr setTextColor<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span>UIColor redColor<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#91;</span>attrStr setFont<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span>UIFont boldSystemFontOfSize<span style="color: #339933;">:</span><span style="color: #0000dd;">18</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#91;</span>attrStr setTextAlignment<span style="color: #339933;">:</span>CTTextAlignmentFromUITextAlignment<span style="color: #009900;">&#40;</span>UITextAlignmentCenter<span style="color: #009900;">&#41;</span>     
                lineBreakMode<span style="color: #339933;">:</span>CTLineBreakModeFromUILineBreakMode<span style="color: #009900;">&#40;</span>UILineBreakModeTailTruncation<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>splits count<span style="color: #009900;">&#93;</span> <span style="color: #339933;">&gt;=</span> <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #993333;">int</span> start <span style="color: #339933;">=</span>  <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>splits objectAtIndex<span style="color: #339933;">:</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span> length<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #993333;">int</span> end <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>splits objectAtIndex<span style="color: #339933;">:</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span> length<span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#91;</span>attrStr setTextColor<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span>UIColor blackColor<span style="color: #009900;">&#93;</span> range<span style="color: #339933;">:</span>NSMakeRange<span style="color: #009900;">&#40;</span>start<span style="color: #339933;">,</span> end<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    label.<span style="color: #202020;">attributedText</span> <span style="color: #339933;">=</span> attrStr<span style="color: #339933;">;</span></pre></div></div>

</p>
<p>The result will be like the screenshot below:<br />
<a href="http://caydenliew.com/wp-content/uploads/2012/01/ohattributedLabel.png"><img src="http://caydenliew.com/wp-content/uploads/2012/01/ohattributedLabel.png" alt="ohattributedLabel" title="ohattributedLabel" width="223" height="112" class="alignleft size-full wp-image-205" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://caydenliew.com/2012/01/uilabel-with-different-style-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customizing UINavigationbar</title>
		<link>http://caydenliew.com/2011/12/customizing-uinavigationbar/</link>
		<comments>http://caydenliew.com/2011/12/customizing-uinavigationbar/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 13:11:30 +0000</pubDate>
		<dc:creator>cayden</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[IOS]]></category>
		<category><![CDATA[iPhone Tutorial]]></category>
		<category><![CDATA[custom navigation bar]]></category>
		<category><![CDATA[forBarMetrics]]></category>
		<category><![CDATA[setBackgroundImage]]></category>
		<category><![CDATA[UINavigationBar]]></category>

		<guid isPermaLink="false">http://caydenliew.com/?p=198</guid>
		<description><![CDATA[Before IOS 5.0, UINavigationbar can be customized by using &#8216;Category&#8217;. On IOS 5.0 onwards, customizing with &#8216;category&#8217; doesn&#8217;t work anymore, instead we can use a new API called: - &#40;void&#41;setBackgroundImage:&#40;UIImage *&#41;backgroundImage forBarMetrics:&#40;UIBarMetrics&#41;barMetrics In order to customize UINavagationBar for both IOS 5.0 and below IOS 5.0 devices, we have to prepare these two methods: 1. Write a category for UINavigationBar (for IOS 4.3 and below) 2. Check if device is IOS 5.0 and above, use &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>Before IOS 5.0, UINavigationbar can be customized by using &#8216;Category&#8217;. On IOS 5.0 onwards, customizing with &#8216;category&#8217; doesn&#8217;t work anymore, instead we can use a new API called:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>setBackgroundImage<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>UIImage <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>backgroundImage forBarMetrics<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>UIBarMetrics<span style="color: #009900;">&#41;</span>barMetrics</pre></div></div>

</p>
<p>
<a href="http://caydenliew.com/wp-content/uploads/2011/12/custom-uinavigationbar.png"><img src="http://caydenliew.com/wp-content/uploads/2011/12/custom-uinavigationbar-300x160.png" alt="custom-uinavigationbar" title="custom-uinavigationbar" width="300" height="160" class="alignleft size-medium wp-image-199" /></a>
</p>
<p>In order to customize UINavagationBar for both IOS 5.0 and below IOS 5.0 devices, we have to prepare these two methods:</p>
<ul>
<li>1. Write a category for UINavigationBar (for IOS 4.3 and below)</li>
<li>2. Check if device is IOS 5.0 and above, use &#8211; (void)setBackgroundImage:(UIImage *)backgroundImage forBarMetrics:(UIBarMetrics)barMetrics</li>
</ul>
<p>To create a category, create a new file name &#8216;CustomNavigationBar&#8217;.<br />
In &#8216;CustomNavigationBar.h&#8217;,</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">@interface CustomNavigationBar <span style="color: #339933;">:</span> UINavigationBar
@end</pre></div></div>

<p>In &#8216;CustomNavigationBar.m&#8217;, draw the navigation bar with your custom image,</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#import &quot;CustomNavigationBar.h&quot;</span>
&nbsp;
@implementation UINavigationBar <span style="color: #009900;">&#40;</span>UINavigationBarCategory<span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>drawRect<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>CGRect<span style="color: #009900;">&#41;</span>rect <span style="color: #009900;">&#123;</span>
    UIColor <span style="color: #339933;">*</span>color <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>UIColor darkGrayColor<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    UIImage <span style="color: #339933;">*</span>img  <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span> @<span style="color: #ff0000;">&quot;img-bgtopbar.png&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#91;</span>img drawInRect<span style="color: #339933;">:</span>CGRectMake<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> self.<span style="color: #202020;">frame</span>.<span style="color: #202020;">size</span>.<span style="color: #202020;">width</span><span style="color: #339933;">,</span> self.<span style="color: #202020;">frame</span>.<span style="color: #202020;">size</span>.<span style="color: #202020;">height</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    self.<span style="color: #202020;">tintColor</span> <span style="color: #339933;">=</span> color<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
@end</pre></div></div>

</p>
<p>To replace the default Navigation bar, just #import &#8216;CustomNavigationBar.h&#8217; in any classes that need to be customized.</p>
<p>To determine the IOS version, check like this:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">float</span> deviceVersion <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>UIDevice currentDevice<span style="color: #009900;">&#93;</span> systemVersion<span style="color: #009900;">&#93;</span> floatValue<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>deviceVersion <span style="color: #339933;">&gt;=</span> <span style="color:#800080;">5.0</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#91;</span>self.<span style="color: #202020;">navigationController</span>.<span style="color: #202020;">navigationBar</span> setBackgroundImage<span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;img-bgtopbar.png&quot;</span><span style="color: #009900;">&#93;</span> forBarMetrics<span style="color: #339933;">:</span>UIBarMetricsDefault<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

</p>
<p>The code above check if the device version is equal to or more than IOS 5.0, if so, use the &#8216;setBackgroundImage&#8217; API. With these 2 methods, you can customize the UINavigationBar for IOS 4.3 and below as well as IOS 5.0</p>
]]></content:encoded>
			<wfw:commentRss>http://caydenliew.com/2011/12/customizing-uinavigationbar/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Modify XCode 4.2 Project Template</title>
		<link>http://caydenliew.com/2011/12/modify-xcode-4-2-project-template/</link>
		<comments>http://caydenliew.com/2011/12/modify-xcode-4-2-project-template/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 13:55:25 +0000</pubDate>
		<dc:creator>cayden</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[IOS]]></category>
		<category><![CDATA[iPhone Tutorial]]></category>
		<category><![CDATA[core data option]]></category>
		<category><![CDATA[Tabbed Application.xctemplate]]></category>
		<category><![CDATA[templateinfo.plist]]></category>
		<category><![CDATA[xcode 4.2 template]]></category>
		<category><![CDATA[xctemplate]]></category>

		<guid isPermaLink="false">http://caydenliew.com/?p=191</guid>
		<description><![CDATA[In this post I&#8217;ll show you how to modify the XCode 4.2 Project Template. When we create a new project in XCode, we can choose which project template to use. However, some project templates provide an options to use Core Data while some not. To enable the Core Data option in a project template, we need to modify the &#8216;TemplateInfo.plist&#8217; which you can find at: Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates/Application/&#40;Application Type&#41;.xctemplate/TemplateInfo.plist For example, by default my Tabbed Application [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I&#8217;ll show you how to modify the XCode 4.2 Project Template.</p>
<p><a href="http://caydenliew.com/wp-content/uploads/2011/12/xcode-template.jpg"><img src="http://caydenliew.com/wp-content/uploads/2011/12/xcode-template-300x203.jpg" alt="xcode-template" title="xcode-template" width="300" height="203" class="alignleft size-medium wp-image-192" /></a></p>
<p>When we create a new project in XCode, we can choose which project template to use. However, some project templates provide an options to use Core Data while some not. To enable the Core Data option in a project template, we need to modify the &#8216;TemplateInfo.plist&#8217; which you can find at:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">Developer<span style="color: #339933;">/</span>Platforms<span style="color: #339933;">/</span>iPhoneOS.<span style="color: #202020;">platform</span><span style="color: #339933;">/</span>Developer<span style="color: #339933;">/</span>Library<span style="color: #339933;">/</span>Xcode<span style="color: #339933;">/</span>Templates<span style="color: #339933;">/</span>Project Templates<span style="color: #339933;">/</span>Application<span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span>Application Type<span style="color: #009900;">&#41;</span>.<span style="color: #202020;">xctemplate</span><span style="color: #339933;">/</span>TemplateInfo.<span style="color: #202020;">plist</span></pre></div></div>

</p>
<p>For example, by default my Tabbed Application does not provide the core data option, what i can do is to open up the template for Tabbed Application at:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">/</span>DeveloperNew<span style="color: #339933;">/</span>Platforms<span style="color: #339933;">/</span>iPhoneOS.<span style="color: #202020;">platform</span><span style="color: #339933;">/</span>Developer<span style="color: #339933;">/</span>Library<span style="color: #339933;">/</span>Xcode<span style="color: #339933;">/</span>Templates<span style="color: #339933;">/</span>Project Templates<span style="color: #339933;">/</span>Application<span style="color: #339933;">/</span>Tabbed Application.<span style="color: #202020;">xctemplate</span><span style="color: #339933;">/</span>TemplateInfo.<span style="color: #202020;">plist</span></pre></div></div>

<p>Open the TemplateInfo.plist in XML format. Then just add one more line:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span>com.<span style="color: #202020;">apple</span>.<span style="color: #202020;">dt</span>.<span style="color: #202020;">unit</span>.<span style="color: #202020;">coreDataCocoaTouchApplication</span><span style="color: #339933;">&lt;/</span>string<span style="color: #339933;">&gt;</span></pre></div></div>

<p>under the &#8216;Ancestors&#8217; key like below:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">&lt;?</span>xml version<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;1.0&quot;</span> encoding<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #339933;">?&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE plist PUBLIC <span style="color: #ff0000;">&quot;-//Apple//DTD PLIST 1.0//EN&quot;</span> <span style="color: #ff0000;">&quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>plist version<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>dict<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>key<span style="color: #339933;">&gt;</span>Ancestors<span style="color: #339933;">&lt;/</span>key<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>array<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span>com.<span style="color: #202020;">apple</span>.<span style="color: #202020;">dt</span>.<span style="color: #202020;">unit</span>.<span style="color: #202020;">storyboardApplication</span><span style="color: #339933;">&lt;/</span>string<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>string<span style="color: #339933;">&gt;</span>com.<span style="color: #202020;">apple</span>.<span style="color: #202020;">dt</span>.<span style="color: #202020;">unit</span>.<span style="color: #202020;">coreDataCocoaTouchApplication</span><span style="color: #339933;">&lt;/</span>string<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;/</span>array<span style="color: #339933;">&gt;</span>
 <span style="color: #339933;">&lt;</span>key<span style="color: #339933;">&gt;</span>Concrete<span style="color: #339933;">&lt;/</span>key<span style="color: #339933;">&gt;</span>
  ...</pre></div></div>

</p>
<p>Now when you create a new Tabbed Application, you&#8217;ll see an option for Core Data.</p>
]]></content:encoded>
			<wfw:commentRss>http://caydenliew.com/2011/12/modify-xcode-4-2-project-template/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>QRCode Reader With ZXing Library</title>
		<link>http://caydenliew.com/2011/12/qrcode-reader-with-zxing-library/</link>
		<comments>http://caydenliew.com/2011/12/qrcode-reader-with-zxing-library/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 10:43:58 +0000</pubDate>
		<dc:creator>cayden</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[IOS]]></category>
		<category><![CDATA[iPhone Tutorial]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[iPhone tutorial]]></category>
		<category><![CDATA[QRCode]]></category>
		<category><![CDATA[ZXing]]></category>

		<guid isPermaLink="false">http://caydenliew.com/?p=181</guid>
		<description><![CDATA[ZXing is an open-source, multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages. In this tutorial, Im going to show you how to make a small modification to the library so that the QRCode reader can read from image as well instead of just camera. First of all, download the ZXing-1.7.zip. After you unzipped it, look for the folder &#8216;iphone&#8217; -> &#8216;Barcodes&#8217;, this is the sample project we will be [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/p/zxing/" title="ZXing" target="_blank">ZXing</a> is an open-source, multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages. In this tutorial, Im going to show you how to make a small modification to the library so that the QRCode reader can read from image as well instead of just camera.</p>
<p><a href="http://caydenliew.com/wp-content/uploads/2011/12/Test.png"><img src="http://caydenliew.com/wp-content/uploads/2011/12/Test.png" alt="QRCode" title="QRCode" width="33" height="33" class="alignleft size-full wp-image-184" /></a>
</p>
<p>First of all, download the <a href="http://code.google.com/p/zxing/downloads/detail?name=ZXing-1.7.zip&#038;can=2&#038;q=" title="ZXing" target="_blank">ZXing-1.7.zip</a>. After you unzipped it, look for the folder &#8216;iphone&#8217; -> &#8216;Barcodes&#8217;, this is the sample project we will be using in this tutorial. If you launch the app in simulator and do the code scanning, it won&#8217;t work as it requires a camera which a simulator doesn&#8217;t have. In order to test the QRCode reader without a device, here&#8217;s a little modification to the library so that it can either scan from camera or image.</p>
<p>In the Barcodes project, you&#8217;ll see a &#8216;ZXMainViewController.mm&#8217;, this is the main controller of the project. There&#8217;s a function called:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>IBAction<span style="color: #009900;">&#41;</span>scan<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span>sender</pre></div></div>

<p>which is the event for scanning button.</p>
<p>What we are going to modify is the controller that control the QRCode scanning:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">ZXingWidgetController <span style="color: #339933;">*</span>widController</pre></div></div>

<p>We will tell this widController to scan from an image instead of using camera. To do that, we need to add 2 extra properties to the ZXingWidgetController.</p>
<p>Now, in the project directory, look for &#8216;dependencies&#8217;. There&#8217;s a &#8216;ZXingWidget.Xcodeproj&#8217;, look for &#8216;classes&#8217; directory, we are only interested in 2 files which are &#8216;ZXingWidgetController.h&#8217; and &#8216;ZXingWidgetController.m&#8217;.</p>
<p>In &#8216;ZXingWidgetController.h&#8217;, add the 2 properties like below:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">@property <span style="color: #009900;">&#40;</span>nonatomic<span style="color: #339933;">,</span> assign<span style="color: #009900;">&#41;</span> BOOL isCamera<span style="color: #339933;">;</span>
@property <span style="color: #009900;">&#40;</span>nonatomic<span style="color: #339933;">,</span> retain<span style="color: #009900;">&#41;</span> UIImage <span style="color: #339933;">*</span>scanImage<span style="color: #339933;">;</span></pre></div></div>

<p>The property &#8216;isCamera&#8217; is to tell the controller to either scan from camera or image. The property &#8216;scanImage&#8217; is the image to be scanned, which is a QRCode. </p>
<p>In &#8216;ZXingWidgetController.m&#8217;, syntesize the properties like:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">@synthesize isCamera<span style="color: #339933;">,</span> scanImage<span style="color: #339933;">;</span></pre></div></div>

<p>In the &#8216;dealloc&#8217; function, release the &#8216;scanImage&#8217; we retain:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>scanImage release<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

</p>
<p>Now, create a new function in &#8216;ZXingWidgetController.m&#8217; to scan the image:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>scannedWithImage<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>UIImage <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>img size<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>CGRect<span style="color: #009900;">&#41;</span>rect<span style="color: #009900;">&#123;</span>
    Decoder <span style="color: #339933;">*</span>d <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>Decoder alloc<span style="color: #009900;">&#93;</span> init<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    d.<span style="color: #202020;">readers</span> <span style="color: #339933;">=</span> readers<span style="color: #339933;">;</span>
    d.<span style="color: #202020;">delegate</span> <span style="color: #339933;">=</span> self<span style="color: #339933;">;</span>
    decoding <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>d decodeImage<span style="color: #339933;">:</span>img cropRect<span style="color: #339933;">:</span>rect<span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> YES <span style="color: #339933;">?</span> NO <span style="color: #339933;">:</span> YES<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#91;</span>d release<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Then, in &#8216;- (void)viewDidAppear:(BOOL)animated&#8217;, modify the code like below:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span>viewDidAppear<span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span>BOOL<span style="color: #009900;">&#41;</span>animated <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#91;</span>super viewDidAppear<span style="color: #339933;">:</span>animated<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  self.<span style="color: #202020;">isStatusBarHidden</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>UIApplication sharedApplication<span style="color: #009900;">&#93;</span> isStatusBarHidden<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>isStatusBarHidden<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>UIApplication sharedApplication<span style="color: #009900;">&#93;</span> setStatusBarHidden<span style="color: #339933;">:</span>YES<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
  decoding <span style="color: #339933;">=</span> YES<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>isCamera<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #009900;">&#91;</span>self initCapture<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#91;</span>self.<span style="color: #202020;">view</span> addSubview<span style="color: #339933;">:</span>overlayView<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#91;</span>overlayView setPoints<span style="color: #339933;">:</span>nil<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #009900;">&#91;</span>self scannedWithImage<span style="color: #339933;">:</span>self.<span style="color: #202020;">scanImage</span> size<span style="color: #339933;">:</span>CGRectMake<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> self.<span style="color: #202020;">scanImage</span>.<span style="color: #202020;">size</span>.<span style="color: #202020;">width</span><span style="color: #339933;">,</span> self.<span style="color: #202020;">scanImage</span>.<span style="color: #202020;">size</span>.<span style="color: #202020;">height</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
  wasCancelled <span style="color: #339933;">=</span> NO<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>What it does here is to check whether it should scan from camera or image, if we choose to scan from image it will call the function &#8216;- (void)scannedWithImage:(UIImage *)img size:(CGRect)rect&#8217; we&#8217;ve just created.
</p>
<p>We can now go back to the &#8216;ZXMainViewController.m&#8217; to set the property of &#8216;ZXingWidgetController&#8217;.</p>
<p>In &#8216;- (IBAction)scan:(id)sender&#8217;, set the property like below:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">  ZXingWidgetController <span style="color: #339933;">*</span>widController <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>ZXingWidgetController alloc<span style="color: #009900;">&#93;</span> initWithDelegate<span style="color: #339933;">:</span>self 
                                                                              showCancel<span style="color: #339933;">:</span>YES 
                                                                                OneDMode<span style="color: #339933;">:</span>NO<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  widController.<span style="color: #202020;">isCamera</span> <span style="color: #339933;">=</span> NO<span style="color: #339933;">;</span>
  UIImage <span style="color: #339933;">*</span>image <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>UIImage imageNamed<span style="color: #339933;">:</span>@<span style="color: #ff0000;">&quot;Test.png&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  widController.<span style="color: #202020;">scanImage</span> <span style="color: #339933;">=</span> image<span style="color: #339933;">;</span></pre></div></div>

<p>Here we set the &#8216;isCamera&#8217; to &#8216;No&#8217; so that we can scan from image. Then we set the QRCode image which is the &#8216;Test.png&#8217; to be scanned.</p>
<p>Now when you launch the app and press the scan button, it will scan from the QRCode image instead of camera.</p>
<p>You may download the sample code for this tutorial <a href="http://caydenliew.com/source-code/?did=3" title="QRCode reader" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://caydenliew.com/2011/12/qrcode-reader-with-zxing-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parsing XML in Objective-C with TouchXML</title>
		<link>http://caydenliew.com/2011/12/parsing-xml-in-objective-c-with-touchxml/</link>
		<comments>http://caydenliew.com/2011/12/parsing-xml-in-objective-c-with-touchxml/#comments</comments>
		<pubDate>Sat, 03 Dec 2011 09:38:40 +0000</pubDate>
		<dc:creator>cayden</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[IOS]]></category>
		<category><![CDATA[IOS Library]]></category>
		<category><![CDATA[iPhone Tutorial]]></category>
		<category><![CDATA[objective-c xml]]></category>
		<category><![CDATA[parse xml]]></category>
		<category><![CDATA[TouchXML]]></category>
		<category><![CDATA[xml parser]]></category>

		<guid isPermaLink="false">http://caydenliew.com/?p=173</guid>
		<description><![CDATA[There&#8217;s a lot of libraries available for parsing XML in Objective-C, one of them is TouchXML. Here&#8217;s a sample source code on how to use TouchXML to parse XML data. You can get the TouchXML here. TouchXML is using XPath, if you never heard of XPath, read it more here.]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a lot of libraries available for parsing XML in Objective-C, one of them is TouchXML.<br />
Here&#8217;s a <a href="http://caydenliew.com/source-code/?did=1">sample source code</a> on how to use TouchXML to parse XML data.</p>
<p><a href="http://caydenliew.com/wp-content/uploads/2011/12/xml_file.png"><img src="http://caydenliew.com/wp-content/uploads/2011/12/xml_file.png" alt="xml_file" title="xml_file" width="128" height="128" class="alignleft size-full wp-image-179" /></a></p>
<p>You can get the TouchXML <a href="https://github.com/TouchCode/TouchXML">here.</a></p>
<p>TouchXML is using XPath, if you never heard of XPath, read it more <a hre="http://www.w3schools.com/xpath/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://caydenliew.com/2011/12/parsing-xml-in-objective-c-with-touchxml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simulate A Location With XCode 4.2</title>
		<link>http://caydenliew.com/2011/12/simulate-a-location-with-xcode-4-2/</link>
		<comments>http://caydenliew.com/2011/12/simulate-a-location-with-xcode-4-2/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 08:22:57 +0000</pubDate>
		<dc:creator>cayden</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[geocoding]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[google map]]></category>
		<category><![CDATA[latitude]]></category>
		<category><![CDATA[longitude]]></category>
		<category><![CDATA[map labs]]></category>
		<category><![CDATA[simulate location]]></category>

		<guid isPermaLink="false">http://caydenliew.com/?p=169</guid>
		<description><![CDATA[Have a Location Base app? Wonder how to test your app in simulator without different locations? Well, in XCode 4.2, you can do that in your simulator. In your XCode, just go to &#8216;Product&#8217; -> &#8216;Debug&#8217; -> &#8216;Simulate Location&#8217; and choose the available locations.]]></description>
			<content:encoded><![CDATA[<p>Have a Location Base app? Wonder how to test your app in simulator without different locations?</p>
<p>Well, in XCode 4.2, you can do that in your simulator. In your XCode, just go to &#8216;Product&#8217; -> &#8216;Debug&#8217; -> &#8216;Simulate Location&#8217; and choose the available locations.</p>
<div id="attachment_170" class="wp-caption alignleft" style="width: 291px"><a href="http://caydenliew.com/wp-content/uploads/2011/12/XCode-simulate-location.jpg"><img src="http://caydenliew.com/wp-content/uploads/2011/12/XCode-simulate-location-281x300.jpg" alt="XCode-simulate-location" title="XCode-simulate-location" width="281" height="300" class="size-medium wp-image-170" /></a><p class="wp-caption-text">XCode-simulate-location</p></div>
]]></content:encoded>
			<wfw:commentRss>http://caydenliew.com/2011/12/simulate-a-location-with-xcode-4-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Longitude and Latitude From Google Map</title>
		<link>http://caydenliew.com/2011/12/get-longitude-and-latitude-from-google-map/</link>
		<comments>http://caydenliew.com/2011/12/get-longitude-and-latitude-from-google-map/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 08:01:05 +0000</pubDate>
		<dc:creator>cayden</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[iPhone Tutorial]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[google map]]></category>
		<category><![CDATA[latitude]]></category>
		<category><![CDATA[longitude]]></category>
		<category><![CDATA[map labs]]></category>

		<guid isPermaLink="false">http://caydenliew.com/?p=163</guid>
		<description><![CDATA[By default, the coordinate will not be shown, in order to show the coordinate. Here&#8217;s how you can get the latitude and longitude of a location from Google Map. Step 1, enter your address and search for the map Step 2, go to setting on the top right corner of your browser Step 3, go to &#8216;Maps Labs&#8217; Step 4, look for &#8216;LatLng Tool Tip&#8217;, set to enable Step 5, go back to your map, [...]]]></description>
			<content:encoded><![CDATA[<p>By default, the coordinate will not be shown, in order to show the coordinate. Here&#8217;s how you can get the latitude and longitude of a location from Google Map.</p>
<ul>
<li>Step 1, enter your address and search for the map</li>
<li>Step 2, go to setting on the top right corner of your browser</li>
<li><div id="attachment_166" class="wp-caption alignleft" style="width: 310px"><a href="http://caydenliew.com/wp-content/uploads/2011/12/google-map-setting.jpg"><img src="http://caydenliew.com/wp-content/uploads/2011/12/google-map-setting-300x174.jpg" alt="google-map-setting" title="google-map-setting" width="300" height="174" class="size-medium wp-image-166" /></a><p class="wp-caption-text">google-map-setting</p></div></li>
<li>Step 3, go to &#8216;Maps Labs&#8217;</li>
<li>Step 4, look for &#8216;LatLng Tool Tip&#8217;, set to enable</li>
<li><div id="attachment_165" class="wp-caption alignleft" style="width: 310px"><a href="http://caydenliew.com/wp-content/uploads/2011/12/google-map-latlng-tooltip.jpg"><img src="http://caydenliew.com/wp-content/uploads/2011/12/google-map-latlng-tooltip-300x245.jpg" alt="google-map-latlng-tooltip" title="google-map-latlng-tooltip" width="300" height="245" class="size-medium wp-image-165" /></a><p class="wp-caption-text">google-map-latlng-tooltip</p></div></li>
<li>Step 5, go back to your map, mouse over to the location and press the &#8216;shift&#8217; key, you&#8217;ll see the latitude and logitude tool tip</li>
<li><div id="attachment_164" class="wp-caption alignleft" style="width: 289px"><a href="http://caydenliew.com/wp-content/uploads/2011/12/google-map-latitude-longitude.jpg"><img src="http://caydenliew.com/wp-content/uploads/2011/12/google-map-latitude-longitude.jpg" alt="google-map-latitude-longitude" title="google-map-latitude-longitude" width="279" height="165" class="size-full wp-image-164" /></a><p class="wp-caption-text">google-map-latitude-longitude</p></div></li>
<p>You can use the longitude and latitude of an address to test your own Location based iphone app.</p>
]]></content:encoded>
			<wfw:commentRss>http://caydenliew.com/2011/12/get-longitude-and-latitude-from-google-map/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PLCrashReporter, The iPhone crash framework</title>
		<link>http://caydenliew.com/2011/11/plcrashreporter-the-iphone-crash-framework/</link>
		<comments>http://caydenliew.com/2011/11/plcrashreporter-the-iphone-crash-framework/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 09:55:29 +0000</pubDate>
		<dc:creator>cayden</dc:creator>
				<category><![CDATA[IOS]]></category>
		<category><![CDATA[IOS Library]]></category>
		<category><![CDATA[iPhone Tutorial]]></category>
		<category><![CDATA[crash framework]]></category>
		<category><![CDATA[crash reporter]]></category>
		<category><![CDATA[iphone debugger]]></category>
		<category><![CDATA[iphone log]]></category>
		<category><![CDATA[PLCrashReporter]]></category>

		<guid isPermaLink="false">http://caydenliew.com/?p=148</guid>
		<description><![CDATA[PLCrashReporter provide an in-process CrashReporter framework for the iPhone and Mac OS X. This framework is very helpful in getting the crash report for your app from beta tester or real users. I&#8217;m not sure how most of the developer ask for the crash report from their users, but one way is to ask them to connect their IOS device to iTune, get the crash report and send them manually, but this is just too [...]]]></description>
			<content:encoded><![CDATA[<p>PLCrashReporter provide an in-process CrashReporter framework for the iPhone and Mac OS X. This framework is very helpful in getting the crash report for your app from beta tester or real users.</p>
<p><a href="http://caydenliew.com/wp-content/uploads/2011/11/PLCrashReporter.jpg"><img src="http://caydenliew.com/wp-content/uploads/2011/11/PLCrashReporter-190x300.jpg" alt="PLCrashReporter" title="PLCrashReporter" width="190" height="300" class="aligncenter size-medium wp-image-150" /></a></p>
<p>I&#8217;m not sure how most of the developer ask for the crash report from their users, but one way is to ask them to connect their IOS device to iTune, get the crash report and send them manually, but this is just too troublesome.</p>
<p>With PLCrashReporter, you can capture the logs and output a crash report and your users can choose to send the report to the developer directly within the app.</p>
<p>To start using PLCrashReporter, </p>
<ul>
<li>First download the <a href="http://code.google.com/p/plcrashreporter/downloads/detail?name=plcrashreporter-1.1-beta1.tar.gz" title="PLCrashReporter source" target="_blank">source release</a>. Extract the package and run the Xcode project, we need to build the crashreport framework using the source before we can use it in our project.</li>
<li>There are a lot of Targets, for this example lets use only the simulator Target. Navigate to the CrashReporter-iPhoneSimulator Target. Under the Build Settings, set &#8220;Perform Single-Object Prelink&#8221; to &#8220;No&#8221;, &#8220;Mach-O Type&#8221; to &#8220;Static Library&#8221;.</li>
<li>Select your simulator as iphone simulator and then click build.</li>
<li>A static library should be built now, navigate to your build directory for the PLCrashReporter, eg. /Users/username/Library/Developer/Xcode/DerivedData/CrashReporter-(random characters)/Build/Products/Debug-iphonesimulator and copy the libCrashReporter-iphonesimulator.a to your project that use the PLCrashReporter.</li>
<p>Now, download the <a href="http://code.google.com/p/plcrashreporter/downloads/detail?name=PLCrashReporter-1.1-beta1.dmg" title="PLCrashReporter release" target="_blank">PLCrashReporter binary release</a> and extract the framework to a local directory.</li>
<li>Open your new project, and add the CrashReporter framework to your project. To add a new framework, click on your project name in XCode, click on your target, under &#8216;Build Phases&#8217; -> &#8216;Link Binary with libraries&#8217;, click the &#8216;+&#8217;, and &#8216;add other&#8217;. Look for the &#8216;libCrashReporter-iphonesimulator.a&#8217; you&#8217;ve built and the CrashReporter.framework you&#8217;ve downloaded, add them into the project.</li>
<p>Now you are ready to use the CrashReporter framework. There&#8217;s a demo project in the source release you&#8217;ve downloaded, you can run the project and see how it works.</p>
<p>For XCode 4, the CrashReporter might have problem in creating the report. If it doesn&#8217;t work, you can try to switch off the GDB debugger. To do this, in XCode, go to Product -> Edit Scheme -> Select the debugger as &#8216;None&#8217;.</p>
<p><p>If it works, you should be able to see a report &#8216;live_report.plcrash&#8217; under your &#8216;application directory/library/caches/com.plausiblelabs.crashreporter.data/com.yourcompany.CrashReporterDemo/&#8217; after you trigger a crash in the demo project.</p>
<p>With PLCrashReporter, you can provide a simpler way for your Beta tester or real users to send the crash report back to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://caydenliew.com/2011/11/plcrashreporter-the-iphone-crash-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

