<?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>de &#187; sdk</title>
	<atom:link href="http://duivesteyn.net/tag/sdk/feed/" rel="self" type="application/rss+xml" />
	<link>http://duivesteyn.net</link>
	<description></description>
	<lastBuildDate>Tue, 20 Apr 2010 22:00:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>iPhone OS SDK &#8211; Checking Internet Reachability</title>
		<link>http://duivesteyn.net/2010/03/16/iphone-os-sdk-checking-internet-reachability/</link>
		<comments>http://duivesteyn.net/2010/03/16/iphone-os-sdk-checking-internet-reachability/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 10:45:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[iPhone SDK Tips]]></category>
		<category><![CDATA[internet reachability]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[sdk]]></category>

		<guid isPermaLink="false">http://duivesteyn.net/2010/03/16/iphone-os-sdk-checking-internet-reachability/</guid>
		<description><![CDATA[Checking for an internet connection is becoming an important part of each iPhone app, as applications and websites evolve to more a more unified experience, getting info off the internet is very important. Checking for an internet connection on iPhone can be a somewhat moderately difficult task. Luckily apple released a Reachability sample code, which [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://duivesteyn.net/wp-content/uploads/2010/03/iphone1.png" rel="lightbox[528]"><img class="size-full wp-image-531 alignright" title="web-browsing-iphone" src="http://duivesteyn.net/wp-content/uploads/2010/03/iphone1.png" alt="" width="208" height="321" /></a>Checking for an internet connection is becoming an important part of each iPhone app, as applications and websites evolve to more a more unified experience, getting info off the internet is very important.<br />
 Checking for an internet connection on iPhone can be a somewhat moderately difficult task. Luckily apple released a <span style="text-decoration: underline;"><a href="http://developer.apple.com/iphone/library/samplecode/Reachability/">Reachability</a></span> sample code, which then makes implementation very easy.<br />
 Well, in line with the recent theme of my site, I’m going to show you how I implemented it in my programming experiences lately.<br />
 I’m going to run you through I how do this in my apps, with a focus on keeping it simple.</p>
<p><strong>Step 1: Add the reachability class from the <a href="http://developer.apple.com/iphone/library/samplecode/Reachability/">Reachability Demo</a></strong><br />
 Download them from the apple sample, or here. Then include them in your Xcode, by dragging the sources into xcode (Copying in is fine).</p>
<p><strong>Step 2: Add the Extra Frameworks</strong><br />
 Add the Foundation and SystemConfiguration inbuilt frameworks to your app.<br />
 <span style="font-size: 12pt;"><a href="http://duivesteyn.net/wp-content/uploads/2010/03/Screen-shot-2010-03-16-at-10.37.42.png" rel="lightbox[528]"><img src="http://duivesteyn.net/wp-content/uploads/2010/03/Screen-shot-2010-03-16-at-10.37.42.CaUeN2xcbHVT.jpg" alt="Screen-shot-2010-03-16-at-10.37.42.CaUeN2xcbHVT.jpg" width="213" height="35" /></a></span><br />
 <strong>Step 3: Think first then code</strong><br />
 <span style="font-size: 12pt;"><img class="alignright" src="http://duivesteyn.net/wp-content/uploads/2010/03/iPhone-Empty-View-Implemented-by-Tapku.D6WKcx9GiT7b.jpg" alt="iPhone-Empty-View-Implemented-by-Tapku.D6WKcx9GiT7b.jpg" width="192" height="276" /></span><br />
 The code is in the next step, but first its important to think where you are going to check for Internet Access. If you only need a particular site to work, change the initial ping to that one site. <a href="http://google.com">google.com</a>, <a href="http://finance.yahoo.com">finance.yahoo.com</a> etc.<br />
 econdly and more importantly, think about where you are going to implement the Reachability test. You will generally only want to do it once, in AppDelegate and then store the outcome as a boolean variable (YES/NO). If there ends up being multiple places in the application where you want to test for internet access, remember to do all the lookup business just once. This will speed up the app and also reduce app owners data transfer per session.<br />
 I am going to implement this such that a separate icon appears in the top right of my app MainView if there is no internet. Checkout the Three20 or Tapku empty pages, of how they implement the nice ‘empty’ screen which seems to be invented for iPhone by apple.</p>
<p><strong>Step 4: The easy bit: The Code</strong><br />
 I want to implement the reachability test in the appDelegate. First lets include the library in appDelegate.h (the header file).<br />
 <span style="color: #643820;">#import </span><span style="color: #c41a16;">&#8220;Reachability.h&#8221;</span></p>
<p>in the <span style="color: #aa0d91;">@interface</span> of the header:<br />
 <span style="color: #007400;">//Got Internets?</span><br />
 <span style="color: #5c2699;">NSString</span> *<span style="color: #3f6e74;">internetReachability</span>;<br />
 <span style="color: #aa0d91;">BOOL</span> <span style="color: #3f6e74;">gotInternet</span>;</p>
<p>and in the bottom of the header, before end:</p>
<p>-(<span style="color: #aa0d91;">BOOL</span>)checkInternet;</p>
<p>In the main of the appDelegate, we add a custom method to handle the work, it does most of the heavy lifting in the Reachability.m file. (Notice how the ping url is <a href="http://finance.yahoo.com">finance.yahoo.com</a>. I recommend pointing this to the website you are interested in interacting with.<br />
 <span style="color: #643820;">#pragma mark -<br />
 #pragma mark Checking Internet Connection<br />
 </span><br />
 -(<span style="color: #aa0d91;">BOOL</span>)checkInternet{<br />
 <span style="color: #007400;">//Test for Internet Connection</span><br />
 <span style="color: #2e0d6e;">NSLog</span>(<span style="color: #c41a16;">@“&#8212;&#8212;&#8211;“</span>);<span style="color: #2e0d6e;">NSLog</span>(<span style="color: #c41a16;">@“Testing Internet Connectivity”</span>);<br />
 <span style="color: #3f6e74;">Reachability</span> *r = [<span style="color: #3f6e74;">Reachability</span> <span style="color: #26474b;">reachabilityWithHostName</span>:<span style="color: #c41a16;">@“</span><a href="http://finance.yahoo.com">finance.yahoo.com</a><span style="color: #c41a16;">”</span>];<br />
 <span style="color: #3f6e74;">NetworkStatus</span> internetStatus = [r <span style="color: #26474b;">currentReachabilityStatus</span>];<br />
 <span style="color: #aa0d91;">BOOL</span> internet;<br />
 <span style="color: #aa0d91;">if</span> ((internetStatus != <span style="color: #26474b;">ReachableViaWiFi</span>) &amp;&amp; (internetStatus != <span style="color: #26474b;">ReachableViaWWAN</span>)) {<br />
 internet = <span style="color: #aa0d91;">NO</span>;<br />
 } <span style="color: #aa0d91;">else</span> {<br />
 internet = <span style="color: #aa0d91;">YES</span>;<br />
 }<br />
 <span style="color: #aa0d91;">return</span> internet;<br />
 }</p>
<p>This method is then able to be called where-ever, but I want to do it in didFinishLaunchingWithOptions. I use the following:<br />
 <span style="color: #3f6e74;">gotInternet</span> = [<span style="color: #aa0d91;">self</span> <span style="color: #26474b;">checkInternet</span>]; <span style="color: #007400;">//Test for Internet, calling the self method</span></p>
<p><span style="color: #aa0d91;">if</span> ( <span style="color: #3f6e74;">gotInternet</span> == <span style="color: #1c00cf;">0</span>) {<br />
 <span style="color: #007400;">//I have no internet</span><br />
 <span style="color: #2e0d6e;">NSLog</span>(<span style="color: #c41a16;">@&#8221;hey, i have no internets&#8221;</span>);<br />
 <span style="color: #3f6e74;">internetIcon</span>.<span style="color: #5c2699;">hidden</span> = <span style="color: #aa0d91;">NO</span>;</p>
<p>} <span style="color: #aa0d91;">else</span> {<br />
 <span style="color: #007400;">//I do have internet</span><br />
 <span style="color: #2e0d6e;">NSLog</span>(<span style="color: #c41a16;">@&#8221;hey, i have internets: all systems go&#8221;</span>);<br />
 }</p>
<p><strong>4. And thats it!</strong></p>
<p>Notice how it now stores the variable accessible class-wide. To check for internet now, just check to see the BOOL output of gotInternet. An extension to this is if there is no internet, show the Tapku empty window instead of something internet input related.</p>
<p>Heres the NSLog output, the second launch of the app I turned wifi on, on the mac.</p>
<p><a href="http://duivesteyn.net/wp-content/uploads/2010/03/post-internet-connection.png" rel="lightbox[528]"><img class="alignnone size-full wp-image-534" title="post - internet connection" src="http://duivesteyn.net/wp-content/uploads/2010/03/post-internet-connection.png" alt="" width="874" height="358" /></a></p>
<p><strong>Hope you found it useful, comments possible below.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://duivesteyn.net/2010/03/16/iphone-os-sdk-checking-internet-reachability/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>iPhone OS Development &#8211; deSimpleChart</title>
		<link>http://duivesteyn.net/2010/02/20/iphone-desimplechart/</link>
		<comments>http://duivesteyn.net/2010/02/20/iphone-desimplechart/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 20:41:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[iPhone SDK Tips]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[plot]]></category>
		<category><![CDATA[sdk]]></category>

		<guid isPermaLink="false">http://duivesteyn.net/?p=449</guid>
		<description><![CDATA[Throughout my current project I&#8217;ve been looking for a simple chart that I can place inside my iPhone Application. There is the best framework around core-plot, but I found is extremely complicated and a little unmanageable for experienced programmers. I then came across CKSparkLine which is a fantastic and simple way of plotting an array [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-thumbnail wp-image-451 alignright" style="border: 2px solid black;" title="deChart" src="http://duivesteyn.net/wp-content/uploads/2010/02/deChart-150x150.png" alt="iPhone SDK Simple Charting Class" width="150" height="150" /></p>
<p>Throughout my current project I&#8217;ve been looking for a simple chart that I can place inside my iPhone Application. There is the best framework around <a href="http://code.google.com/p/core-plot/" target="_blank">core-plot</a>, but I found is extremely complicated and a little unmanageable for experienced programmers. I then came across <a href="http://key-solutions.ca/cksparkline.html" target="_blank">CKSparkLine</a> which is a fantastic and simple way of plotting an array of data to a uiview.</p>
<p>In my work I have lead to a slightly adapted CKSparkLine which would be useful enough to help someone else who wants a simple chart plot in an iPhone App.</p>
<p>Introducing the sample code: deSimpleChart. A &#8216;simple&#8217; chart plot based  off CKSparkLine to help a programmer new to iPhone development out. Below a screenshot of the complete output of the application. Keeping the idea simple and easy to learn from.</p>
<p style="text-align: center;"><img class="size-full wp-image-450 aligncenter" title="Screen shot 2010-02-20 at 21.05.29" src="http://duivesteyn.net/wp-content/uploads/2010/02/Screen-shot-2010-02-20-at-21.05.29.png" alt="" width="539" height="290" /></p>
<p><br class="spacer_" /></p>
<p><strong>deSimpleChart 0.01  <br />
 <span style="font-weight: normal;">Build &#8220;Keeping charts simple&#8221;</span></strong></p>
<p><a href="http://duivesteyn.net/wp-content/uploads/2010/02/Screen-shot-2010-02-20-at-22.19.56.png" rel="lightbox[449]"><img class="alignnone size-full wp-image-457" title="de Simple Chart Icon" src="http://duivesteyn.net/wp-content/uploads/2010/02/Screen-shot-2010-02-20-at-22.19.56.png" alt="" width="373" height="161" /></a></p>
<p>Download at <a href="http://github.com/duivesteyn-enterprises/deSimpleChart" target="_blank">Github</a><br />
-&gt;&#8221;git clone git://github.com/duivesteyn-enterprises/deSimpleChart.git&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://duivesteyn.net/2010/02/20/iphone-desimplechart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone iPad Development &#8211; Quick &#8211; TableView Properties</title>
		<link>http://duivesteyn.net/2010/02/12/iphone-ipad-development-quick-tableview-properties/</link>
		<comments>http://duivesteyn.net/2010/02/12/iphone-ipad-development-quick-tableview-properties/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 07:00:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[iPhone SDK Tips]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[object dimensions]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[tableview dimensions]]></category>
		<category><![CDATA[willRotateToInterfaceOrientation]]></category>

		<guid isPermaLink="false">http://duivesteyn.net/?p=366</guid>
		<description><![CDATA[I am currently working on supporting multi orientations of the iPhone (iPad) Screen, where on rotation some objects will be resized and others will be moved. For example I am wanting to move a tableView object and I want to ensure when I rotate back to Portrait that the tableview ends up in the exact [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://duivesteyn.net/wp-content/uploads/2010/02/iPad.png" rel="lightbox[366]"><img class="alignright size-full wp-image-380" title="iPad" src="http://duivesteyn.net/wp-content/uploads/2010/02/iPad.png" alt="" width="202" height="255" /></a>I am currently working on supporting multi orientations of the iPhone (iPad) Screen, where on rotation some objects will be resized and others will be moved. For example I am wanting to move a tableView object and I want to ensure when I rotate back to Portrait that the tableview ends up in the exact same place before I moved it.</p>
<p>I came up with some quick debug code you can use in your iPhone App Development (or iPad App development).</p>
<p>The idea is you get the H,W,X,Y co-ordinates and can then later perfectly replace the initial properties.</p>
<p><strong>Run this in viewDidAppear (for example)</strong></p>
<p>int height = tableView.frame.size.height;<br />
 int width = tableView.frame.size.width;<br />
 int x = tableView.frame.origin.x;<br />
 int y = tableView.frame.origin.y;</p>
<p>NSLog(@&#8221;TableView Height:%d&#8221;,height);<br />
 NSLog(@&#8221;TableViewWidth:%d&#8221;,width);<br />
 NSLog(@&#8221;TableViewX:%d&#8221;,x);<br />
 NSLog(@&#8221;TableViewY:%d&#8221;,y);</p>
<p><br class="spacer_" /></p>
<p><strong>Then later in willRotateToInterfaceOrientation you can use the code:</strong></p>
<p>tableView.frame = CGRectMake(x, y,	w, h);  //where x,y are the frame origin coordinates (x,y) and w,h are the width and height of the frame</p>
]]></content:encoded>
			<wfw:commentRss>http://duivesteyn.net/2010/02/12/iphone-ipad-development-quick-tableview-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
