<?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>iPhone Tutorial &#124; iPhone iOS4 iPad SDK Development &#38; Programming Blog &#187; iphone tutorials</title>
	<atom:link href="http://www.edumobile.org/iphone/tag/iphone-tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.edumobile.org/iphone</link>
	<description></description>
	<lastBuildDate>Wed, 25 Jan 2012 09:42:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using iPhone TableView for Displaying Data</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/using-iphone-tableview-for-displaying-data/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/using-iphone-tableview-for-displaying-data/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 09:18:23 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Beginner Tutorials]]></category>
		<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[iphone tutorials]]></category>
		<category><![CDATA[tableview example]]></category>
		<category><![CDATA[Using iPhone TableView for Displaying Data]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2732</guid>
		<description><![CDATA[This is the "TableView" example. There are many ways to display the "TableView" in iPhone. I am going to show you the simplest way to execute the TableView.]]></description>
			<content:encoded><![CDATA[<p>This is the &#8220;TableView&#8221; example. There are many ways to display the &#8220;TableView&#8221; in iPhone. I am going to show you the simplest way to execute the TableView.</p>
<p><strong>Step 1:</strong> Open the Xcode and create a new Xcode project using View base application template. Give the application name &#8220;TableView&#8221;. As shown in the figure below:</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/04/Tab.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/04/Tab-300x220.jpg" alt="" title="Tab" width="300" height="220" class="alignnone size-medium wp-image-2735" /></a></p>
<p><strong>Step 2:</strong> Expand classes and notice Interface Builder created the Table_ViewViewController.h and Table_ViewViewController.m class for you. Expand Resources and notice the template generated a separate nib, Table_ViewViewController.xib.</p>
<p><strong>Step 3:</strong> Open the TableViewViewController.h file and make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span></p>
<p><span class="kw1">@interface</span> Table_ViewViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>listData;</p>
<p><span class="br0">&#125;</span><br />
<span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic,retain<span class="br0">&#41;</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>listData;<br />
<span class="kw1">@end</span></div>
</div>
<p><strong>Step 4:</strong> Double click the Table_ViewViewController.xib file and after that make the following changes.<br />
A) Open the view window, first drag the table view from the library and place it to the view window and select the table.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/04/tabv.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/04/tabv-195x300.jpg" alt="" title="tabv" width="195" height="300" class="alignnone size-medium wp-image-2733" /></a></p>
<p>B) Connect File&#8217;s Owner icon to tableview and select &#8220;View&#8221;.<br />
Once this is done, save the TableViewViewController.xib file, close it and go back to the Xcode.</p>
<p><strong>Step 5:</strong> If you want to add some image in table, then you have to go to Resources folder and add image in resource folder.</p>
<p><strong>Step 6:</strong> Open the TableViewViewController.m file and make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;Table_ViewViewController.h&quot;</span></p>
<p><span class="kw1">@implementation</span> Table_ViewViewController<br />
<span class="kw1">@synthesize</span> listData;</p>
<p><span class="co2">// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>array <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> alloc<span class="br0">&#93;</span> initWithObjects<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Vishal&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Vinod&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Sachin&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Nilesh&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Balu&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Amrita&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co3">@</span><span class="st0">&quot;susho&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Akash&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Nil&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Lop&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Koi&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Absoulate&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Dwalin&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co3">@</span><span class="st0">&quot;Fili&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Kili&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Oin&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Gloin&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Bifur&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Bofur&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Bombur&quot;</span>,<span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; self.listData <span class="sy0">=</span> array;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>array release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.listData<span class="sy0">=</span> array;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>didReceiveMemoryWarning <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">// Releases the view if it doesn&#8217;t have a superview.</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">// Release any cached data, images, etc that aren&#8217;t in use.</span><br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidUnload <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">// Release any retained subviews of the main view.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">// e.g. self.myOutlet = nil;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>dealloc <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super dealloc<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>tableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView<br />
numberOfRowsInSection<span class="sy0">:</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>section<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="br0">&#91;</span>self.listData count<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>UITableViewCell <span class="sy0">*</span><span class="br0">&#41;</span>tableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cellForRowAtIndexPath<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span class="kw5">NSIndexPath</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>indexPath<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">static</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>SimpleTableIdentifier <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;SimpleTableIdentifier&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UITableViewCell <span class="sy0">*</span>cell <span class="sy0">=</span> <span class="br0">&#91;</span>tableView dequeueReusableCellWithIdentifier<span class="sy0">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SimpleTableIdentifier<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>cell <span class="sy0">==</span> <span class="kw2">nil</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cell <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UITableViewCell alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span>CGRectZero<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reuseIdentifier<span class="sy0">:</span> SimpleTableIdentifier<span class="br0">&#93;</span> autorelease<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NSUInteger row <span class="sy0">=</span> <span class="br0">&#91;</span>indexPath row<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cell.textLabel.text <span class="sy0">=</span> <span class="br0">&#91;</span>listData objectAtIndex<span class="sy0">:</span>row<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">//cell.font=[UIFont boldSystemFontOfSize:20];</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; UIImage <span class="sy0">*</span>image <span class="sy0">=</span> <span class="br0">&#91;</span>UIImage imageNamed<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;macosxlogo.png&quot;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cell.image <span class="sy0">=</span> image;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> cell;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p><strong>Step 7:</strong> Now build and run the code and view the Output in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/04/finata.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/04/finata-181x300.jpg" alt="" title="finata" width="181" height="300" class="alignnone size-medium wp-image-2734" /></a></p>
<p>You can <strong>download source code</strong> from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/04/TableView.zip'>TableView</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/using-iphone-tableview-for-displaying-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ImageRotate using touch in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/imagerotate-using-touch-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/imagerotate-using-touch-in-iphone/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 11:41:32 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[ImageRotate using touch in iPhone]]></category>
		<category><![CDATA[iPhone example]]></category>
		<category><![CDATA[iphone tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2702</guid>
		<description><![CDATA[This is the ImageRotate example . In this example we will see how to image rotate anywhere of the screen using touch.]]></description>
			<content:encoded><![CDATA[<p>This is the ImageRotate example . In this example we will see how to image rotate anywhere of the screen using touch.</p>
<p><strong>Step 1:</strong> Create a View base application using template. Give the application name “ImageMove_iPhone”.</p>
<p><strong>Step 2: </strong>Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3: </strong>Xpand classes and notice Interface Builder created the ImageMove_iPhoneViewController class for you. Expand Resources and notice the template generated a separate nib,ImageMove_iPhoneViewController.xib, for the “ImageMove_iPhone”.</p>
<p><strong>Step 4:</strong> We need to add UIView class in the project. Select Classes -&gt; Add -&gt; New File -&gt; Cocoa Touch Class -&gt; Objective C class -&gt; select UIView from the Subclass of. Give the file name “ImageMove”.</p>
<p><strong>Step 5:</strong> We have added one resource in the Resources folder. Give the name of the resource “11.jpg”,&#8221;feder.jpg&#8221;.</p>
<p><strong>Step 6:</strong> In the ImageMove.h file, we specified the superclass as a UIImageView. So make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span></p>
<p><span class="kw1">@interface</span> ImageMove <span class="sy0">:</span> UIImageView <span class="br0">&#123;</span></p>
<p><span class="br0">&#125;</span></div>
</div>
<p><strong>Step 7:</strong> Open the ImageMov.m file , make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span> initWithImage<span class="sy0">:</span><span class="br0">&#40;</span>UIImage <span class="sy0">*</span><span class="br0">&#41;</span>image <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>self <span class="sy0">=</span> <span class="br0">&#91;</span>super initWithImage<span class="sy0">:</span>image<span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self setUserInteractionEnabled<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self setMultipleTouchEnabled<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">return</span> self;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span> touchesMoved<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSSet_Class/"><span class="kw5">NSSet</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>touches withEvent<span class="sy0">:</span><span class="br0">&#40;</span>UIEvent <span class="sy0">*</span><span class="br0">&#41;</span>event<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>touches count<span class="br0">&#93;</span> <span class="sy0">==</span> 1<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CGPoint newTouch <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>touches anyObject<span class="br0">&#93;</span> locationInView<span class="sy0">:</span><span class="br0">&#91;</span>self superview<span class="br0">&#93;</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CGPoint lastTouch <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>touches anyObject<span class="br0">&#93;</span> previousLocationInView<span class="sy0">:</span> <span class="br0">&#91;</span>self superview<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">float</span> xDif <span class="sy0">=</span> newTouch.x <span class="sy0">-</span> lastTouch.x; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">float</span> yDif <span class="sy0">=</span> newTouch.y <span class="sy0">-</span> lastTouch.y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CGAffineTransform translate <span class="sy0">=</span> CGAffineTransformMakeTranslation<span class="br0">&#40;</span>xDif, yDif<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self setTransform<span class="sy0">:</span> CGAffineTransformConcat<span class="br0">&#40;</span><span class="br0">&#91;</span>self transform<span class="br0">&#93;</span>, translate<span class="br0">&#41;</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 8:</strong> In the the ImageMove_iPhoneViewController.h file we have import “ImageMove.h” file.</p>
<p><strong>Step 9:</strong> Open the mageMove_iPhoneViewController.m file, we create ImageView and make it visible. So make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; ImageMove<span class="sy0">*</span> imageMove <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>ImageMove alloc<span class="br0">&#93;</span> initWithImage<span class="sy0">:</span><span class="br0">&#91;</span>UIImage imageNamed<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;11.jpg&quot;</span><span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>imageMove setFrame<span class="sy0">:</span>CGRectMake<span class="br0">&#40;</span>110, 60, <span class="br0">&#91;</span>imageMove frame<span class="br0">&#93;</span>.size.width,<span class="br0">&#91;</span>imageMove frame<span class="br0">&#93;</span>.size.height<span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span><span class="br0">&#91;</span>self view<span class="br0">&#93;</span> addSubview<span class="sy0">:</span>imageMove<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>imageMove release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; ImageMove<span class="sy0">*</span> imageMove1 <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>ImageMove alloc<span class="br0">&#93;</span> initWithImage<span class="sy0">:</span><span class="br0">&#91;</span>UIImage imageNamed<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;feder.jpg&quot;</span><span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>imageMove1 setFrame<span class="sy0">:</span>CGRectMake<span class="br0">&#40;</span>110, 200, <span class="br0">&#91;</span>imageMove1 frame<span class="br0">&#93;</span>.size.width,<span class="br0">&#91;</span>imageMove1 frame<span class="br0">&#93;</span>.size.height<span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span><span class="br0">&#91;</span>self view<span class="br0">&#93;</span> addSubview<span class="sy0">:</span>imageMove1<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>imageMove1 release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; </p>
<p><span class="br0">&#125;</span></div>
</div>
<p><strong>Step 10:</strong> Now compile and run the application in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/02/1-8.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/02/1-8-184x300.jpg" alt="" title="1-8" width="184" height="300" class="alignnone size-medium wp-image-2704" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/02/ImageMove_iPhone.zip'>ImageMove_iPhone</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/imagerotate-using-touch-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Music Play in iPhoneOS4</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/music-play-in-iphoneos4/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/music-play-in-iphoneos4/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 13:27:15 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[iphone tutorials]]></category>
		<category><![CDATA[Music Play]]></category>
		<category><![CDATA[Music Play in iPhoneOS4]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2517</guid>
		<description><![CDATA[This is the very simple example . In this application we will see how to play music in iPhone oS4.]]></description>
			<content:encoded><![CDATA[<p>This is the very simple example . In this application we will see how to play music in iPhone oS4.</p>
<p><strong>Step 1:</strong> Create a new project in Xcode using View base application. Give the application name “MusicPlay_OS4”.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> xpand classes and notice Interface Builder created the MusicPlay_OS4ViewController class for you. Expand Resources and notice the template generated a separate nib, MusicPlay_OS4ViewController.xib, for the “MusicPlay_OS4”.</p>
<p><strong>Step 4:</strong> We need to add sound files in the Resources folder. Give the name of the sound files “music.mp3”,”sound.aif”. And also add a backgroung image.</p>
<p><strong>Step 5:</strong> We need to add also two frameworks.So select Frameworks -&gt; Add -&gt; Existing Framework -&gt; then select AVFoundation.framework and AudioToolbox.framework.</p>
<p><strong>Step 6:</strong> In the MusicPlay_OS4ViewController.h file, we have  importAVFoundation.framework and AudioToolbox.framework. Create a instance of  AVAudioPlayer and UIButton class and create two IBAction method. So make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span><br />
<span class="co1">#import &lt;AudioToolbox/AudioToolbox.h&gt;</span><br />
<span class="co1">#import &lt;AVFoundation/AVFoundation.h&gt;</span></p>
<p><span class="kw1">@interface</span> MusicPlay_OS4ViewController <span class="sy0">:</span> UIViewController <br />
&lt;AVAudioPlayerDelegate&gt;<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; SystemSoundID systemSoundID;<br />
&nbsp; &nbsp; &nbsp; &nbsp; AVAudioPlayer <span class="sy0">*</span>player;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIButton <span class="sy0">*</span>StartStopSound;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet AVAudioPlayer <span class="sy0">*</span>player;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UIButton <span class="sy0">*</span>StartStopSound;</p>
<p>
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> playSound<span class="sy0">:</span> <span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span> sender;<br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> playSong<span class="sy0">:</span> <span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span> sender;</div>
</div>
<p><strong>Step 7:</strong> Double click the MusicPlay_OS4ViewController.xib file and open it to the Interface Builder. First drag the Image View from the library and place it to the View window. Select the image view and bring up Attribute Inspector, select the background image. Drag two Round Rect button from the library and place it to the view window.Give the name of the button &#8220;Play Sound &#8220;and &#8220;Play Song&#8221; Connect File&#8217;s Owner icon to the View icon and select View. Drag File&#8217;s Owner icon to the Play Song button and select StartStopSound. Select the Play Sound button and bring up Connection Inspector and drag from the Touch Up Inside to the File&#8217;s Owner icon, select playSound: action. Do the same thing with PlaySong button and select the playSong: action. Now save the MusicPlay_OS4ViewController.xib file, close it and go back to the Xcode.</p>
<p><strong>Step 8: </strong>Open the MusicPlay_OS4ViewController.m file and make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;InView did load&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; AudioServicesCreateSystemSoundID<span class="br0">&#40;</span><span class="br0">&#40;</span>CFURLRef<span class="br0">&#41;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> fileURLWithPath<span class="sy0">:</span><span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span class="kw5">NSBundle</span></a> mainBundle<span class="br0">&#93;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pathForResource<span class="sy0">:</span> <span class="co3">@</span><span class="st0">&quot;sound&quot;</span> ofType<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;aif&quot;</span><span class="br0">&#93;</span><span class="br0">&#93;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sy0">&amp;</span>systemSoundID<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; player <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>AVAudioPlayer alloc<span class="br0">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; initWithContentsOfURL<span class="sy0">:</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> fileURLWithPath<span class="sy0">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span class="kw5">NSBundle</span></a> mainBundle<span class="br0">&#93;</span> pathForResource<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;music&quot;</span> ofType<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;mp3&quot;</span><span class="br0">&#93;</span><span class="br0">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>player prepareToPlay<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></p>
<p>
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> playSound<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span> sender <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;In Sample&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; AudioServicesPlaySystemSound<span class="br0">&#40;</span>systemSoundID<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> playSong<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span> sender <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> stringWithFormat<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;%@&quot;</span>, <span class="br0">&#91;</span>StartStopSound titleForState<span class="sy0">:</span>UIControlStateNormal<span class="br0">&#93;</span><span class="br0">&#93;</span> isEqualToString<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Play Song&quot;</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>player play<span class="br0">&#93;</span>;&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>StartStopSound setTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Stop Song&quot;</span> forState<span class="sy0">:</span>UIControlStateNormal<span class="br0">&#93;</span>; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span> <span class="br0">&#123;</span>&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>player stop<span class="br0">&#93;</span>;&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>StartStopSound setTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Play Song&quot;</span> forState<span class="sy0">:</span>UIControlStateNormal<span class="br0">&#93;</span>; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 9:</strong> Now compile and run the application in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-76.jpg"><img class="alignnone size-medium wp-image-2518" title="1-7" src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-76-160x300.jpg" alt="" width="160" height="300" /></a></p>
<p>You can <strong>Download Source</strong> Code from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2010/07/MusicPlay_OS4.zip'>MusicPlay_OS4</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/music-play-in-iphoneos4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Display WebPage and AudioFile play in TabBar Application</title>
		<link>http://www.edumobile.org/iphone/ipad-development/display-webpage-and-audiofile-play-in-tabbar-application/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/display-webpage-and-audiofile-play-in-tabbar-application/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 10:17:58 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[Display WebPage and AudioFile Play]]></category>
		<category><![CDATA[Display WebPage and AudioFile play in TabBar Application]]></category>
		<category><![CDATA[iphone tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2497</guid>
		<description><![CDATA[This is the TabBar application. In this application we will see how to display Web page and play audio file in the iPad. We will create this application using TabBar Application Template.]]></description>
			<content:encoded><![CDATA[<p>This is the TabBar application. In this application we will see how to display Web page and play audio file in the iPad. We will create this application using TabBar Application Template.</p>
<p><strong>Step 1:</strong> Create a TabBar application using template. Give the application name &#8220;Tabbar_Videoplay_iPad&#8221;.</p>
<p><strong>Step 2</strong>: code automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> Xpand classes and notice Interface Builder created the FirstViewController class for you. Expand Resources and notice the template generated a separate  nib,FirstViewr.xib, for the “ Tabbar_Videoplay_iPad”.</p>
<p><strong>Step 4:</strong> We need to add UIViewController class in the project . Select classes -> Add -> New Files -> Select UIViewController class and give the class name &#8220;AudioPlayViewController&#8221;. Select corresponding .xib file and targeted for iPad.</p>
<p><strong>Step 5: </strong>We have added AudioToolbox and AVFoundation framework in the Frameworks folder.</p>
<p><strong>Step 6:</strong> We need to add two music file in the resource folder. Give the name of the music file &#8220;sound.aif&#8221;,&#8221;music.mp3&#8243;.</p>
<p><strong>Step 7:</strong> In the FirstViewController.h file we have created instance of UIWebView class . So make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span></p>
<p><span class="kw1">@interface</span> FirstViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
&nbsp; IBOutlet UIWebView <span class="sy0">*</span>webDisplay;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic,retain<span class="br0">&#41;</span> UIWebView <span class="sy0">*</span>webDisplay;</div>
</div>
<p><strong>Step 8: </strong>Double click the MainWindow.xib file and open it to the Interface Builder. Select the FirstViewController from the TabBar Controller and bring up Attribute Inspector and delete the NIB name (See the figure 1). Now drag the WebView from the library and place it to the view window (See the figure 2). Select the first tab from the view window and bring up Connection Inspector and connect webDisplay to the Web View (See the figure 3). Save the MainWindow.xib file and close it and go back to the Xcode.<br />
<a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-77.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-77-300x215.jpg" alt="" title="1-7" width="300" height="215" class="alignnone size-medium wp-image-2565" /></a></p>
<p>               <strong>Figure 1</strong></p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/2-42.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/2-42-300x225.jpg" alt="" title="2-4" width="300" height="225" class="alignnone size-medium wp-image-2566" /></a></p>
<p>                  <strong>Figure 2</strong></p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/3-1.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/3-1-300x215.jpg" alt="" title="3-1" width="300" height="215" class="alignnone size-medium wp-image-2567" /></a></p>
<p>                 <strong>Figure 3</strong></p>
<p><strong>Step 9: </strong>Open the FirstViewController.m file and make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>urlAddress <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;http://www.google.com&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> <span class="sy0">*</span>url <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> URLWithString<span class="sy0">:</span>urlAddress<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/"><span class="kw5">NSURLRequest</span></a> <span class="sy0">*</span>requestObj <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/"><span class="kw5">NSURLRequest</span></a> requestWithURL<span class="sy0">:</span>url<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>webDisplay loadRequest<span class="sy0">:</span>requestObj<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 10: </strong>In the AudioPlayViewController.h file , we have import AudioToolbox and AVFoundation framework. Create an instance of  AVAudioPlayer and UIButton class. Define two IBAction method. So make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span><br />
<span class="co1">#import &lt;AudioToolbox/AudioToolbox.h&gt;</span><br />
<span class="co1">#import &lt;AVFoundation/AVFoundation.h&gt;</span></p>
<p><span class="kw1">@interface</span> AudioPlayViewController <span class="sy0">:</span> UIViewController &nbsp;&lt;AVAudioPlayerDelegate&gt; <span class="br0">&#123;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; SystemSoundID systemSoundID;<br />
&nbsp; &nbsp; &nbsp; &nbsp; AVAudioPlayer <span class="sy0">*</span>player;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIButton <span class="sy0">*</span>StartStopSound;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet AVAudioPlayer <span class="sy0">*</span>player;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UIButton <span class="sy0">*</span>StartStopSound;</p>
<p>
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> playSound<span class="sy0">:</span> <span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span> sender;<br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> playSong<span class="sy0">:</span> <span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span> sender;</div>
</div>
<p><strong>Step 11: </strong>Double click the AudioPlayViewController.xib file and open it to the view window. First drag the two Round Rect from the library and place it to the view window and give the name &#8220;Play Sound&#8221; , &#8220;Play Song&#8221;. Select the  &#8221;Play Sound&#8221; button and bring up connection Inspector and drag Touch Up Inside to the File Owner icon select playSound: action. Do the same thing for the &#8220;Play Song&#8221;  button and select the playSong: action. Connect File&#8217;s Owner icon to the &#8220;Play Song&#8221; button and select StartStopSound. Now save the AudioPlayViewController.xib file, close it and go back to the Xcode.</p>
<p><strong>Step 12:</strong> Open the AudioPlayViewController.m file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;InView did load&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; AudioServicesCreateSystemSoundID<span class="br0">&#40;</span><span class="br0">&#40;</span>CFURLRef<span class="br0">&#41;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> fileURLWithPath<span class="sy0">:</span><span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span class="kw5">NSBundle</span></a> mainBundle<span class="br0">&#93;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pathForResource<span class="sy0">:</span> <span class="co3">@</span><span class="st0">&quot;sound&quot;</span> ofType<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;aif&quot;</span><span class="br0">&#93;</span><span class="br0">&#93;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sy0">&amp;</span>systemSoundID<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; player <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>AVAudioPlayer alloc<span class="br0">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; initWithContentsOfURL<span class="sy0">:</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> fileURLWithPath<span class="sy0">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span class="kw5">NSBundle</span></a> mainBundle<span class="br0">&#93;</span> pathForResource<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;music&quot;</span> ofType<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;mp3&quot;</span><span class="br0">&#93;</span><span class="br0">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>player prepareToPlay<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></p>
<p>
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> playSound<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span> sender <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;In Sample&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; AudioServicesPlaySystemSound<span class="br0">&#40;</span>systemSoundID<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> playSong<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span> sender <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> stringWithFormat<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;%@&quot;</span>, <span class="br0">&#91;</span>StartStopSound titleForState<span class="sy0">:</span>UIControlStateNormal<span class="br0">&#93;</span><span class="br0">&#93;</span> isEqualToString<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Play Song&quot;</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>player play<span class="br0">&#93;</span>;&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>StartStopSound setTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Stop Song&quot;</span> forState<span class="sy0">:</span>UIControlStateNormal<span class="br0">&#93;</span>; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span> <span class="br0">&#123;</span>&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>player stop<span class="br0">&#93;</span>;&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>StartStopSound setTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Play Song&quot;</span> forState<span class="sy0">:</span>UIControlStateNormal<span class="br0">&#93;</span>; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 13:</strong> Double click the MainWindow.xib file and open it to the Interface Builder. Select the ViewController from the TabBar Controller  in MainWindow and bring up Identity Inspector and change the class name into AudioPlayViewController and bring up Attribute Inspector, set the NIB name into &#8220;AudioPlayViewController&#8221;. Now save the MainWindow.xib file, close it and go back to the Xcode.</p>
<p><strong>Step 14: </strong>Now Compile the application and run it in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-74.jpg"><img class="alignnone size-medium wp-image-2498" title="1-7" src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-74-234x300.jpg" alt="" width="234" height="300" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/Tabbar_Videoplay_iPad.zip">Tabbar_Videoplay_iPad</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/display-webpage-and-audiofile-play-in-tabbar-application/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Hello World with Navigation Base application in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/hello-world-with-navigation-base-application-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/hello-world-with-navigation-base-application-in-iphone/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 11:42:14 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[Hello World with Navigation Base]]></category>
		<category><![CDATA[Hello World with Navigation Base application in iPhone]]></category>
		<category><![CDATA[iphone tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2434</guid>
		<description><![CDATA[This is the very simple example. In this example we will see how to Hello iPhone display using navigation base application.]]></description>
			<content:encoded><![CDATA[<p>This is the very simple example. In this example we will see how to Hello iPhone display using navigation base application.</p>
<p><strong>Step 1:</strong> Create a Navigation Base application using template. Give the application name &#8220;HelloWorld_NavigationBase&#8221;.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> Xpand classes and notice Interface Builder created the RootViewController class for you (See the figure below). Expand Resources and notice the template generated a separate nib,RootViewController.xib, for the “HelloWorld_NavigationBase”.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-72.jpg"><img class="alignnone size-medium wp-image-2435" title="1-7" src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-72-184x300.jpg" alt="" width="184" height="300" /></a></p>
<p><strong>Step 4:</strong> Open the RootViewController.m file, for this example we need to add only two lines of code in this file . So make the changes.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;</p>
<p><span class="co2">// Uncomment the following line to display an Edit button in the navigation bar for this view controller.</span><br />
&nbsp; &nbsp; &nbsp;self.navigationItem.rightBarButtonItem <span class="sy0">=</span> self.editButtonItem;<br />
<span class="br0">&#125;</span></p>
<p>&nbsp; <span class="sy0">-</span> <span class="br0">&#40;</span>UITableViewCell <span class="sy0">*</span><span class="br0">&#41;</span>tableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView &nbsp; cellForRowAtIndexPath<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span class="kw5">NSIndexPath</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>indexPath <span class="br0">&#123;</span></p>
<p>&nbsp; &nbsp;<span class="kw4">static</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>CellIdentifier <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;Cell&quot;</span>;</p>
<p>&nbsp; &nbsp;UITableViewCell <span class="sy0">*</span>cell <span class="sy0">=</span> <span class="br0">&#91;</span>tableView &nbsp;dequeueReusableCellWithIdentifier<span class="sy0">:</span>CellIdentifier<span class="br0">&#93;</span>;<br />
&nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>cell <span class="sy0">==</span> <span class="kw2">nil</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp;cell <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UITableViewCell alloc<span class="br0">&#93;</span> &nbsp; initWithStyle<span class="sy0">:</span>UITableViewCellStyleDefault reuseIdentifier<span class="sy0">:</span>CellIdentifier<span class="br0">&#93;</span> &nbsp; &nbsp;autorelease<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p>&nbsp; <span class="co2">// Configure the cell. // added below two line</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span><span class="br0">&#91;</span>cell textLabel<span class="br0">&#93;</span> setTextAlignment<span class="sy0">:</span>UITextAlignmentCenter<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#91;</span>cell.textLabel setText<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Hello iPhone!&quot;</span><span class="br0">&#93;</span>;</p>
<p>&nbsp; &nbsp;<span class="kw1">return</span> cell;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 5:</strong> Now compile and run the application in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/2-41.jpg"><img class="alignnone size-medium wp-image-2436" title="2-4" src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/2-41-170x300.jpg" alt="" width="170" height="300" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/HelloWorld_NavigationBase.zip">HelloWorld_NavigationBase</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/hello-world-with-navigation-base-application-in-iphone/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MapKit example in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/mapkit-example-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/mapkit-example-in-iphone/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 11:01:52 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[iphone tutorials]]></category>
		<category><![CDATA[MapKit example]]></category>
		<category><![CDATA[MapKit example in iPhone]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2421</guid>
		<description><![CDATA[In this application we will see how to map display and how to point out any location using latitude and longitude.
]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to map display and how to point out any location using latitude and longitude.</p>
<p><strong>Step 1:</strong> Create a View base application using template. Give the application name “MapKitDisplay”.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> Xpand classes and notice Interface Builder created the MapKitDisplayViewController class for you. Expand Resources and notice the template generated a separate nib, MapKitDisplay ViewController.xib, for the “ MapKitDisplay”.</p>
<p><strong>Step 4:</strong> We need to add NSObject class in the project. Select Classes -> Add -> New File -> Cocoa Touch Class -> Objective C class -> select NSObject from the Subclass of. Give the file name “DisplayMap”.</p>
<p><strong>Step 5:</strong> We have added two framework in the project. Select Frameworks -> Add -> Existing Frameworks -> Add CoreLocation.framework and MapKit.framework.</p>
<p><strong>Step 6:</strong> In the MapKitDisplayViewController.h file, we have import MapKit framework, and define MKMapViewDelegate protocol in the file, also add Outlet with a pointer to the MkMapView class. So make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span><br />
<span class="co1">#import &lt;MapKit/MapKit.h&gt;</span></p>
<p><span class="kw1">@class</span> DisplayMap;</p>
<p><span class="kw1">@interface</span> MapKitDisplayViewController <span class="sy0">:</span> UIViewController &lt;MKMapViewDelegate&gt; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; IBOutlet MKMapView <span class="sy0">*</span>mapView;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet MKMapView <span class="sy0">*</span>mapView;</div>
</div>
<p><strong>Step 7:</strong> Double click the MapKitDisplayViewController.xib file and open it to the Interface Builder. First drag the MapView from the library and place it to the view window. Connect File&#8217;s Owner icon to the View icon and select view. Connect File&#8217;s Owner icon to the MKMapView and select mapView. Now save the MapKitDisplayViewController.xib file, close it and go back to the Xcode.</p>
<p><strong>Step 8:</strong> Open the MapKitDisplayViewController.m file and make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mapView setMapType<span class="sy0">:</span>MKMapTypeStandard<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mapView setZoomEnabled<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mapView setScrollEnabled<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; MKCoordinateRegion region <span class="sy0">=</span> <span class="br0">&#123;</span> <span class="br0">&#123;</span>0.0, 0.0 <span class="br0">&#125;</span>, <span class="br0">&#123;</span> 0.0, 0.0 <span class="br0">&#125;</span> <span class="br0">&#125;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; region.center.latitude <span class="sy0">=</span> 22.569722 ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; region.center.longitude <span class="sy0">=</span> <span class="nu0">88.369722</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; region.span.longitudeDelta <span class="sy0">=</span> 0.01f;<br />
&nbsp; &nbsp; &nbsp; &nbsp; region.span.latitudeDelta <span class="sy0">=</span> 0.01f;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mapView setRegion<span class="sy0">:</span>region animated<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mapView setDelegate<span class="sy0">:</span>self<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; DisplayMap <span class="sy0">*</span>ann <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>DisplayMap alloc<span class="br0">&#93;</span> init<span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; ann.title <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot; Kolkata&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ann.subtitle <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;Mahatma Gandhi Road&quot;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; ann.coordinate <span class="sy0">=</span> region.center; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mapView addAnnotation<span class="sy0">:</span>ann<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>MKAnnotationView <span class="sy0">*</span><span class="br0">&#41;</span>mapView<span class="sy0">:</span><span class="br0">&#40;</span>MKMapView <span class="sy0">*</span><span class="br0">&#41;</span>mV viewForAnnotation<span class="sy0">:</span><br />
&nbsp;<span class="br0">&#40;</span><span class="kw4">id</span> &lt;MKAnnotation&gt;<span class="br0">&#41;</span>annotation <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; MKPinAnnotationView <span class="sy0">*</span>pinView <span class="sy0">=</span> <span class="kw2">nil</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>annotation <span class="sy0">!=</span> mapView.userLocation<span class="br0">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">static</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>defaultPinID <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;com.invasivecode.pin&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pinView <span class="sy0">=</span> <span class="br0">&#40;</span>MKPinAnnotationView <span class="sy0">*</span><span class="br0">&#41;</span><span class="br0">&#91;</span>mapView dequeueReusableAnnotationViewWithIdentifier<span class="sy0">:</span>defaultPinID<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span> pinView <span class="sy0">==</span> <span class="kw2">nil</span> <span class="br0">&#41;</span> pinView <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><span class="br0">&#91;</span>MKPinAnnotationView alloc<span class="br0">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; initWithAnnotation<span class="sy0">:</span>annotation reuseIdentifier<span class="sy0">:</span>defaultPinID<span class="br0">&#93;</span> autorelease<span class="br0">&#93;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pinView.pinColor <span class="sy0">=</span> MKPinAnnotationColorRed; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pinView.canShowCallout <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pinView.animatesDrop <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mapView.userLocation setTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;I am here&quot;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> pinView;<br />
<span class="br0">&#125;</span></div>
</div>
<p>We define here first, coordinate regions to zeros, Then we enter coordinates of our place that, Kolkata (Mahatma Gandhi Road), define the latitude and longitude of this place. We create an instantiate of DisplayView object and add it to our map. To do this, we add the delegate function that will display the annotations on to our map. We start by having DisplayView name a pointer we’ll call “ann.”</p>
<p><strong>Step 8:</strong> In the DisplayView.h file , we have import <MapKit/MKAnnotation.h> and set CLLocation class reference to incorporate the geographical coordinates and altitude of our device. So make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;Foundation/Foundation.h&gt;</span><br />
<span class="co1">#import &lt;MapKit/MKAnnotation.h&gt;</span></p>
<p><span class="kw1">@interface</span> DisplayMap <span class="sy0">:</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span class="kw5">NSObject</span></a> &lt;MKAnnotation&gt; <span class="br0">&#123;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; CLLocationCoordinate2D coordinate; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>title; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>subtitle;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, assign<span class="br0">&#41;</span> CLLocationCoordinate2D coordinate; <br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, copy<span class="br0">&#41;</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>title; <br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, copy<span class="br0">&#41;</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>subtitle;</div>
</div>
<p><strong>Step 9:</strong> Open the DisplayView.m file and make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;DisplayMap.h&quot;</span></p>
<p>
<span class="kw1">@implementation</span> DisplayMap</p>
<p><span class="kw1">@synthesize</span> coordinate,title,subtitle;</p>
<p>
<span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>dealloc<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>title release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>super dealloc<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 10:</strong> Now compile and run the application on the simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/11.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/11-170x300.jpg" alt="" title="1" width="170" height="300" class="alignnone size-medium wp-image-2422" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2010/07/MapKitDisplay.zip'>MapKitDisplay</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/mapkit-example-in-iphone/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Image change using touch function in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/image-change-using-touch-function-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/image-change-using-touch-function-in-iphone/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 07:48:08 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[image change using touch function]]></category>
		<category><![CDATA[Image change using touch function in iPhone]]></category>
		<category><![CDATA[iphone tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2412</guid>
		<description><![CDATA[In this application we will see how to images change using touch function.]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to images change using touch function.</p>
<p><strong>Step 1:</strong> Create a Window base application using template. Give the application name “MovingBall12”.</p>
<p><strong>Step 2 : </strong>Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> We need to add UIView class i the project. Select Classes -&gt; Add -&gt; New File -&gt; Cocoa Touch Class -&gt; Objective C class -&gt; select UIView from the Subclass of. Give the file name “BallView”.</p>
<p><strong>Step 4:</strong> We have added two resources in the Resources folder. Give the name of the resource “1.png”,&#8221;2.png&#8221;.</p>
<p><strong>Step 5:</strong> In the MovingBall12AppDeleagte.h file, we have added BallView class, NSTimer , so make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span></p>
<p><span class="kw1">@class</span> BallView;</p>
<p><span class="kw1">@interface</span> MovingBall12AppDelegate <span class="sy0">:</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span class="kw5">NSObject</span></a> &lt;UIApplicationDelegate&gt; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; UIWindow <span class="sy0">*</span>window;<br />
&nbsp; &nbsp; &nbsp; &nbsp; BallView <span class="sy0">*</span>ballView;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> count;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/"><span class="kw5">NSTimer</span></a> <span class="sy0">*</span>ViewTimer;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UIWindow <span class="sy0">*</span>window;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet BallView <span class="sy0">*</span>ballView;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/"><span class="kw5">NSTimer</span></a> <span class="sy0">*</span>ViewTimer;</div>
</div>
<p><strong>Step 6:</strong> Open the BallView.h file, we have added UIImageView, UILabel, NSTimer, so make the following chnages:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span></p>
<p>
<span class="kw1">@interface</span> BallView <span class="sy0">:</span> UIView <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/"><span class="kw5">NSTimer</span></a> <span class="sy0">*</span>ViewTimer;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIImageView <span class="sy0">*</span>theBall;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UILabel <span class="sy0">*</span>touchMe;<br />
&nbsp; &nbsp; &nbsp; &nbsp; CGRect touchMeFrame;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> count,switcher;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> directionX, directionY;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">BOOL</span> gameRunning;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>images;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic,retain<span class="br0">&#41;</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/"><span class="kw5">NSTimer</span></a> <span class="sy0">*</span>ViewTimer;<br />
<span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic,retain<span class="br0">&#41;</span> IBOutlet UIImageView <span class="sy0">*</span>theBall;<br />
<span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic,retain<span class="br0">&#41;</span> IBOutlet UILabel <span class="sy0">*</span>touchMe;<br />
<span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic,retain<span class="br0">&#41;</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>images;</p>
<p><span class="kw1">@property</span> CGRect touchMeFrame;<br />
<span class="kw1">@property</span> <span class="kw4">int</span> directionX, directionY;<br />
<span class="kw1">@property</span> <span class="kw4">BOOL</span> gameRunning;</div>
</div>
<p><strong>Step 7:</strong> Double click the MainWindow,xib file and open it to the Interface Builder. Double click the window icon from the main window and open it , first drag the View from the library and place it to the window. Next drag label and ImageView from the library and place it to the view window. Select the View from the main window and bring up Identity Inspector and change the class name into BallView. Connect BallView to the label and select touchMe,and connect BallView to the ImageView and select the theBall (See the figure below). Now save MainWindow.xib file, close it and go back to the Xcode.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-7.jpg"><img class="alignnone size-medium wp-image-2414" title="1-7" src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-7-300x214.jpg" alt="" width="300" height="214" /></a></p>
<p><strong>Step 8:</strong> Open the BallView.m fie make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>onTimer <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; CGPoint center <span class="sy0">=</span> theBall.center;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">float</span> newX <span class="sy0">=</span> center.x <span class="sy0">+</span> directionX;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">float</span> newY <span class="sy0">=</span> center.y <span class="sy0">+</span> directionY;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> rndX <span class="sy0">=</span> <a href="http://www.opengroup.org/onlinepubs/009695399/functions/rand.html"><span class="kw3">rand</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">%</span> 3 <span class="sy0">+</span> <span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> rndY <span class="sy0">=</span> <a href="http://www.opengroup.org/onlinepubs/009695399/functions/rand.html"><span class="kw3">rand</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">%</span> 3 <span class="sy0">+</span> <span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> screenX <span class="sy0">=</span> self.frame.origin.x <span class="sy0">+</span> self.frame.size.width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> screenY <span class="sy0">=</span> self.frame.origin.y <span class="sy0">+</span> self.frame.size.height;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">BOOL</span> changed <span class="sy0">=</span> <span class="kw2">NO</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>newX &lt; 0<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; directionX <span class="sy0">=</span> rndX;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newX <span class="sy0">=</span> <span class="nu0">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; changed <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>newX &gt; screenX<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; directionX <span class="sy0">=</span> <span class="sy0">-</span>rndX;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newX <span class="sy0">=</span> screenX;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; changed <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>newY &lt; 0<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; directionY <span class="sy0">=</span> rndY;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newY <span class="sy0">=</span> <span class="nu0">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; changed <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>newY &gt; screenY<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; directionY <span class="sy0">=</span> <span class="sy0">-</span>rndY;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newY <span class="sy0">=</span> screenY;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; changed <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span><a href="http://www.opengroup.org/onlinepubs/009695399/functions/rand.html"><span class="kw3">rand</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">%</span> 1000<span class="br0">&#41;</span> &gt; 997<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; directionY <span class="sy0">*=</span> <span class="sy0">-</span><span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; changed <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span><a href="http://www.opengroup.org/onlinepubs/009695399/functions/rand.html"><span class="kw3">rand</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">%</span> 1000<span class="br0">&#41;</span> &gt; 997<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; directionX <span class="sy0">*=</span> <span class="sy0">-</span><span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; changed <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>changed <span class="sy0">==</span> <span class="kw2">YES</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> img <span class="sy0">=</span> switcher<span class="sy0">++</span> <span class="sy0">%</span> <span class="br0">&#40;</span><span class="kw4">int</span><span class="br0">&#41;</span><span class="br0">&#91;</span>images count<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; theBall.image <span class="sy0">=</span> <span class="br0">&#91;</span>images objectAtIndex<span class="sy0">:</span>img<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; CGPoint newCenter <span class="sy0">=</span> CGPointMake<span class="br0">&#40;</span>newX, newY<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>theBall setCenter<span class="sy0">:</span>newCenter<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>toggleTimer<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">int</span><span class="br0">&#41;</span>withCount <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>withCount <span class="sy0">%</span> 2 <span class="sy0">!=</span> 0<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>ViewTimer invalidate<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; touchMe.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor whiteColor<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; touchMe.textColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor blackColor<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gameRunning <span class="sy0">=</span> <span class="kw2">NO</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ViewTimer <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/"><span class="kw5">NSTimer</span></a> scheduledTimerWithTimeInterval<span class="sy0">:</span>0.0075 target<span class="sy0">:</span>self selector<span class="sy0">:</span><span class="kw1">@selector</span><span class="br0">&#40;</span>onTimer<span class="br0">&#41;</span> userInfo<span class="sy0">:</span><span class="kw2">nil</span> repeats<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; touchMe.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor blackColor<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; touchMe.textColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor whiteColor<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gameRunning <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>doInitialSetup <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; sranddev<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; count <span class="sy0">=</span> <span class="nu0">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> rndX <span class="sy0">=</span> <a href="http://www.opengroup.org/onlinepubs/009695399/functions/rand.html"><span class="kw3">rand</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">%</span> 3 <span class="sy0">+</span> <span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> rndY <span class="sy0">=</span> <a href="http://www.opengroup.org/onlinepubs/009695399/functions/rand.html"><span class="kw3">rand</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">%</span> 3 <span class="sy0">+</span> <span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; directionX <span class="sy0">=</span> <span class="sy0">-</span>rndX;<br />
&nbsp; &nbsp; &nbsp; &nbsp; directionY <span class="sy0">=</span> <span class="sy0">-</span>rndY;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; UIImage <span class="sy0">*</span>img1 <span class="sy0">=</span> <span class="br0">&#91;</span>UIImage imageNamed<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;1.png&quot;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIImage <span class="sy0">*</span>img2 <span class="sy0">=</span> <span class="br0">&#91;</span>UIImage imageNamed<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;2.png&quot;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; self.images <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> arrayWithObjects<span class="sy0">:</span>img1, img2, <span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> img <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw4">int</span><span class="br0">&#41;</span>count <span class="sy0">%</span> <span class="br0">&#40;</span><span class="kw4">int</span><span class="br0">&#41;</span><span class="br0">&#91;</span>images count<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; theBall.image <span class="sy0">=</span> <span class="br0">&#91;</span>images objectAtIndex<span class="sy0">:</span>img<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; gameRunning <span class="sy0">=</span> <span class="kw2">NO</span>;<br />
<span class="br0">&#125;</span></p>
<p>
<span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span> isPointInTouchMe<span class="sy0">:</span><span class="br0">&#40;</span>CGPoint<span class="br0">&#41;</span>point <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="br0">&#40;</span>point.x &gt;<span class="sy0">=</span> touchMe.frame.origin.x <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">&amp;&amp;</span> point.x &lt;<span class="sy0">=</span> touchMe.frame.origin.x <span class="sy0">+</span> touchMe.frame.size.width <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">&amp;&amp;</span> point.y &gt;<span class="sy0">=</span> touchMe.frame.origin.y <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">&amp;&amp;</span> point.y &lt;<span class="sy0">=</span> touchMe.frame.origin.y <span class="sy0">+</span> touchMe.frame.size.height<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></p>
<p>
<span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span> isPointInTheBall<span class="sy0">:</span><span class="br0">&#40;</span>CGPoint<span class="br0">&#41;</span>point <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="br0">&#40;</span>point.x &gt;<span class="sy0">=</span> theBall.frame.origin.x<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">&amp;&amp;</span> point.x &lt;<span class="sy0">=</span> theBall.frame.origin.x <span class="sy0">+</span> theBall.frame.size.width<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">&amp;&amp;</span> point.y &gt;<span class="sy0">=</span> theBall.frame.origin.y<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">&amp;&amp;</span> point.y &lt;<span class="sy0">=</span> theBall.frame.origin.y <span class="sy0">+</span> theBall.frame.size.height<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span> touchesEnded<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSSet_Class/"><span class="kw5">NSSet</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>touches withEvent<span class="sy0">:</span><span class="br0">&#40;</span>UIEvent <span class="sy0">*</span><span class="br0">&#41;</span>event <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; UITouch <span class="sy0">*</span>touch <span class="sy0">=</span> <span class="br0">&#91;</span>touches anyObject<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; CGPoint point <span class="sy0">=</span> <span class="br0">&#91;</span>touch locationInView<span class="sy0">:</span>self<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>self isPointInTouchMe<span class="sy0">:</span>point<span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self toggleTimer<span class="sy0">:</span>count<span class="sy0">++</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span> awakeFromNib <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self doInitialSetup<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>initWithFrame<span class="sy0">:</span><span class="br0">&#40;</span>CGRect<span class="br0">&#41;</span>frame <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>self <span class="sy0">=</span> <span class="br0">&#91;</span>super initWithFrame<span class="sy0">:</span>frame<span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self doInitialSetup<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="kw1">return</span> self;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>drawRect<span class="sy0">:</span><span class="br0">&#40;</span>CGRect<span class="br0">&#41;</span>rect <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>super drawRect<span class="sy0">:</span>rect<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 9:</strong> Now compile and run the application on the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/2-4.jpg"><img class="alignnone size-medium wp-image-2413" title="2-4" src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/2-4-164x300.jpg" alt="" width="164" height="300" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2010/07/MovingBall12.zip'>MovingBall12</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/image-change-using-touch-function-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send SMS from the iPhone OS4</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/send-sms-from-the-iphone-os4/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/send-sms-from-the-iphone-os4/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 06:58:07 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[iphone tutorials]]></category>
		<category><![CDATA[Send SMS]]></category>
		<category><![CDATA[Send SMS from the iPhone OS4]]></category>

		<guid isPermaLink="false">http://edumobile.org/iphone/?p=2378</guid>
		<description><![CDATA[This is the very simple example. In this example we will see how to SMS Send from the iPhone OS4.]]></description>
			<content:encoded><![CDATA[<p>This is the very simple example. In this example we will see how to SMS Send from the iPhone OS4.</p>
<p><strong>Step 1:</strong> Create a View base application using template. Give the application name “SMSSend”.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> Xpand classes and notice Interface Builder created the SMSSendViewController class for you. Expand Resources and notice the template generated a separate nib,SMSSendViewController.xib, for the “SMSSend”.</p>
<p><strong>Step 4:</strong> We need to add MessageUI.framework in the Frameworks folder. Select-&gt; Frameworks folder -&gt; Add -&gt;Existing Frameworks -&gt; then select MessageUI.framework.</p>
<p><strong>Step 5:</strong> In the SMSSendViewController.h file , we have created instance of UILable class and define one method. So make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span><br />
<span class="co1">#import &lt;MessageUI/MessageUI.h&gt;</span><br />
<span class="co1">#import &lt;MessageUI/MFMessageComposeViewController.h&gt;</span></p>
<p><span class="kw1">@interface</span> SMSSendViewController <span class="sy0">:</span> UIViewController &lt;MFMessageComposeViewControllerDelegate&gt; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; UILabel <span class="sy0">*</span>SMS;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> UILabel <span class="sy0">*</span>SMS;</p>
<p><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>ComposerSheet;</div>
</div>
<p><strong>Step 6: </strong>Open the SMSSendViewController.m file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIButton <span class="sy0">*</span>smsButton <span class="sy0">=</span> <span class="br0">&#91;</span>UIButton buttonWithType<span class="sy0">:</span>UIButtonTypeRoundedRect<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; smsButton.frame <span class="sy0">=</span> CGRectMake<span class="br0">&#40;</span>97.0, 301.0, 125.0, 37.0<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; smsButton.adjustsImageWhenDisabled <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>smsButton setTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;SMS Send&quot;</span> forState<span class="sy0">:</span>UIControlStateNormal<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>smsButton setTitleColor<span class="sy0">:</span><span class="br0">&#91;</span>UIColor colorWithWhite<span class="sy0">:</span>0.000 alpha<span class="sy0">:</span>1.000<span class="br0">&#93;</span> forState<span class="sy0">:</span>UIControlStateNormal<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>smsButton setTitleShadowColor<span class="sy0">:</span><span class="br0">&#91;</span>UIColor colorWithWhite<span class="sy0">:</span>0.000 alpha<span class="sy0">:</span>1.000<span class="br0">&#93;</span> forState<span class="sy0">:</span>UIControlStateNormal<span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>smsButton addTarget<span class="sy0">:</span>self action<span class="sy0">:</span><span class="kw1">@selector</span><span class="br0">&#40;</span>ComposerSheet<span class="br0">&#41;</span> forControlEvents<span class="sy0">:</span>UIControlEventTouchUpInside<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; SMS <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UILabel alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span>CGRectMake<span class="br0">&#40;</span>20.0, 360.0, 280.0, 29.0<span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; SMS.frame <span class="sy0">=</span> CGRectMake<span class="br0">&#40;</span>20.0, 360.0, 280.0, 29.0<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; SMS.adjustsFontSizeToFitWidth <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; SMS.hidden <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; SMS.text <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; SMS.userInteractionEnabled <span class="sy0">=</span> <span class="kw2">NO</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self.view addSubview<span class="sy0">:</span>smsButton<span class="br0">&#93;</span>; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self.view addSubview<span class="sy0">:</span>SMS<span class="br0">&#93;</span>; &nbsp;<br />
&nbsp; &nbsp;<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>ComposerSheet <br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; MFMessageComposeViewController <span class="sy0">*</span>picker <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>MFMessageComposeViewController alloc<span class="br0">&#93;</span> init<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; picker.messageComposeDelegate <span class="sy0">=</span> self;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; picker.recipients <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> arrayWithObject<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;23234567&quot;</span><span class="br0">&#93;</span>; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; picker.body <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;iPhone OS4&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self presentModalViewController<span class="sy0">:</span>picker animated<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>picker release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>messageComposeViewController<span class="sy0">:</span><span class="br0">&#40;</span>MFMessageComposeViewController <span class="sy0">*</span><span class="br0">&#41;</span>controller didFinishWithResult<span class="sy0">:</span><span class="br0">&#40;</span>MessageComposeResult<span class="br0">&#41;</span>result <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; SMS.hidden <span class="sy0">=</span> <span class="kw2">NO</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">switch</span> <span class="br0">&#40;</span>result<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> MessageComposeResultCancelled<span class="sy0">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SMS.text <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;Result: canceled&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;Result: canceled&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> MessageComposeResultSent<span class="sy0">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SMS.text <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;Result: sent&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;Result: sent&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> MessageComposeResultFailed<span class="sy0">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SMS.text <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;Result: failed&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;Result: failed&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">default</span><span class="sy0">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SMS.text <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;Result: not sent&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;Result: not sent&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self dismissModalViewControllerAnimated<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 7:</strong> Now compile and run the application. Remember you need to run this application on the iPhone device not a simulator.</p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://edumobile.org/iphone/wp-content/uploads/2010/07/SMSSend.zip'>SMSSend</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/send-sms-from-the-iphone-os4/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to Play Video in iPhoneOS4</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/how-to-play-video-in-iphoneos4/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/how-to-play-video-in-iphoneos4/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 12:21:16 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[How to Play Video in iPhoneOS4]]></category>
		<category><![CDATA[iphone tutorials]]></category>
		<category><![CDATA[Play Video]]></category>

		<guid isPermaLink="false">http://edumobile.org/iphone/?p=2372</guid>
		<description><![CDATA[In this example we will see how to play video in iPhone OS4.]]></description>
			<content:encoded><![CDATA[<p>In this example we will see how to play video in iPhone OS4.</p>
<p><strong>Step 1:</strong> Create a View base application using template. Give the application name “VideoPlayiPhoneOS4”.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> Xpand classes and notice Interface Builder created the VideoPlayiPhoneOS4ViewController class for you. Expand Resources and notice the template generated a separate nib,VideoPlayiPhoneOS4ViewController.xib, for the “VideoPlayiPhoneOS4”.</p>
<p><strong>Step 4</strong><strong>:</strong> We need to add MediaPlayer.framework in the Frameworks folder. Select-&gt; Frameworks folder -&gt; Add -&gt;Existing Frameworks -&gt; then select MediaPlayer.framework.</p>
<p><strong>Step 5: </strong>In the VideoPlayiPhoneOS4ViewController.h file , we have created instance of MPMoviePlayerController class, that manage the playback of a movie from a file or from the network, and create a instance of NSURL class . So make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span><br />
<span class="co1">#import &lt;MediaPlayer/MediaPlayer.h&gt;</span></p>
<p><span class="kw1">@interface</span> VideoPlayiPhoneOS4ViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span></p>
<p>&nbsp; &nbsp; MPMoviePlayerController <span class="sy0">*</span>moviePlayer;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> <span class="sy0">*</span>movieURL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 6:</strong> Open the VideoPlayiPhoneOS4ViewController.m file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewWillAppear<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>animated<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>urlStr <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span class="kw5">NSBundle</span></a> mainBundle<span class="br0">&#93;</span> pathForResource<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;3idiots.mov&quot;</span> ofType<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> <span class="sy0">*</span>url <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> fileURLWithPath<span class="sy0">:</span>urlStr<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; moviePlayer <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>MPMoviePlayerController alloc<span class="br0">&#93;</span> initWithContentURL<span class="sy0">:</span>url<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self.view addSubview<span class="sy0">:</span>moviePlayer.view<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; moviePlayer.view.frame <span class="sy0">=</span> CGRectMake<span class="br0">&#40;</span>0, 0, 300, 400<span class="br0">&#41;</span>; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>moviePlayer play<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 7: </strong>Now compile and run the application in the Simulator.</p>
<p><a href="http://edumobile.org/iphone/wp-content/uploads/2010/06/Video.jpg"><img src="http://edumobile.org/iphone/wp-content/uploads/2010/06/Video-157x300.jpg" alt="" title="Video" width="157" height="300" class="alignnone size-medium wp-image-2375" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://edumobile.org/iphone/wp-content/uploads/2010/06/VideoPlayiPhoneOS4.zip'>VideoPlayiPhoneOS4</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/how-to-play-video-in-iphoneos4/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>LocalNotification in iPhone OS4</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/localnotification-in-iphone-os4/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/localnotification-in-iphone-os4/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 13:14:10 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[iphone tutorials]]></category>
		<category><![CDATA[LocalNotification]]></category>
		<category><![CDATA[LocalNotification in iPhone OS4]]></category>

		<guid isPermaLink="false">http://edumobile.org/iphone/?p=2203</guid>
		<description><![CDATA[In this application we will see how to LocalNotification worked. Basically, apple has added new services called Local Notification, which lets apps lunch notifications without the need for an external server.]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to LocalNotification worked. Basically, apple has added new services called Local Notification, which lets apps lunch notifications without the need for an external server.</p>
<p><strong>Step 1:</strong> Create a Window base application using template. Give the application name “Multitusking_LocalNotify”.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> In the Multitusking_LocalNotifyAppDelegate.h file, we have added one instance variable bgTask. So make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span></p>
<p><span class="kw1">@interface</span> Multitusking_LocalNotifyAppDelegate <span class="sy0">:</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span class="kw5">NSObject</span></a> &lt;UIApplicationDelegate&gt; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; UIWindow <span class="sy0">*</span>window;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIBackgroundTaskIdentifier bgTask;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UIWindow <span class="sy0">*</span>window;</div>
</div>
<p><strong>Step 4:</strong> Open the Multitusking_LocalNotifyAppDelegate.m file , and make the following changes in  the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="kw1">@interface</span> ItemList <span class="sy0">:</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span class="kw5">NSObject</span></a> &nbsp;<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NSInteger year;<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSInteger month;<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSInteger day;<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSInteger hour;<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSInteger minute;<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSInteger second;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>eventName;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, readwrite<span class="br0">&#41;</span> NSInteger year;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, readwrite<span class="br0">&#41;</span> NSInteger month;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, readwrite<span class="br0">&#41;</span> NSInteger day;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, readwrite<span class="br0">&#41;</span> NSInteger hour;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, readwrite<span class="br0">&#41;</span> NSInteger minute;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, readwrite<span class="br0">&#41;</span> NSInteger second;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, copy<span class="br0">&#41;</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>eventName;</p>
<p><span class="kw1">@end</span></p>
<p><span class="kw1">@implementation</span> ItemList</p>
<p><span class="kw1">@synthesize</span> year, month, day, hour, minute, second, eventName;</p>
<p><span class="kw1">@end</span></p>
<p><span class="co1">#import &quot;Multitusking_LocalNotifyAppDelegate.h&quot;</span></p>
<p><span class="kw1">@implementation</span> Multitusking_LocalNotifyAppDelegate</p>
<p><span class="kw1">@synthesize</span> window;</p>
<p>
<span class="co1">#define ItemListKey @&quot;EVENTKEY1&quot;</span><br />
<span class="co1">#define MessageTitleKey @&quot;MSGKEY1&quot;</span></p>
<p>
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>application<span class="sy0">:</span><span class="br0">&#40;</span>UIApplication <span class="sy0">*</span><span class="br0">&#41;</span>application didFinishLaunchingWithOptions<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span class="kw5">NSDictionary</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>launchOptions <span class="br0">&#123;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;application: didFinishLaunchingWithOptions:&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="co2">// Override point for customization after application launch</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; UILocalNotification <span class="sy0">*</span>localNotif <span class="sy0">=</span> <span class="br0">&#91;</span>launchOptions<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;objectForKey<span class="sy0">:</span>UIApplicationLaunchOptionsLocalNotificationKey<span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>localNotif<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>itemName <span class="sy0">=</span> <span class="br0">&#91;</span>localNotif.userInfo objectForKey<span class="sy0">:</span>ItemListKey<span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">// &nbsp;[viewController displayItem:itemName]; // custom method </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; application.applicationIconBadgeNumber <span class="sy0">=</span> localNotif.applicationIconBadgeNumber<span class="sy0">-</span><span class="nu0">1</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;has localNotif %@&quot;</span>,itemName<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span><span class="br0">&#91;</span>UIApplication sharedApplication<span class="br0">&#93;</span> cancelAllLocalNotifications<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span class="kw5">NSDate</span></a> <span class="sy0">*</span>now <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span class="kw5">NSDate</span></a> date<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;now is %@&quot;</span>,now<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span class="kw5">NSDate</span></a> <span class="sy0">*</span>scheduled <span class="sy0">=</span> <span class="br0">&#91;</span>now dateByAddingTimeInterval<span class="sy0">:</span>120<span class="br0">&#93;</span> ; <span class="co2">//get x minute after</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSCalendar_Class/"><span class="kw5">NSCalendar</span></a> <span class="sy0">*</span>calendar <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSCalendar_Class/"><span class="kw5">NSCalendar</span></a> currentCalendar<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">unsigned</span> <span class="kw4">int</span> unitFlags <span class="sy0">=</span> NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit|NSHourCalendarUnit|NSMinuteCalendarUnit;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDateComponents_Class/"><span class="kw5">NSDateComponents</span></a> <span class="sy0">*</span>comp <span class="sy0">=</span> <span class="br0">&#91;</span>calendar components<span class="sy0">:</span>unitFlags fromDate<span class="sy0">:</span>scheduled<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;scheduled is %@&quot;</span>,scheduled<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ItemList <span class="sy0">*</span>itemList <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>ItemList alloc<span class="br0">&#93;</span> init<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; itemList.day <span class="sy0">=</span> <span class="br0">&#91;</span>comp day<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; itemList.month <span class="sy0">=</span> <span class="br0">&#91;</span>comp month<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; itemList.year <span class="sy0">=</span> <span class="br0">&#91;</span>comp year<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; itemList.hour <span class="sy0">=</span> <span class="br0">&#91;</span>comp hour<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; itemList.minute <span class="sy0">=</span> <span class="br0">&#91;</span>comp minute<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; itemList.eventName <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;Testing Event&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">//&nbsp; &nbsp; &nbsp; NSLog(@&quot;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&quot;);</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self scheduleNotificationWithItem<span class="sy0">:</span>itemList interval<span class="sy0">:</span>1<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;scheduleNotificationWithItem&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>window makeKeyAndVisible<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">YES</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>application<span class="sy0">:</span><span class="br0">&#40;</span>UIApplication <span class="sy0">*</span><span class="br0">&#41;</span>application didReceiveLocalNotification<span class="sy0">:</span><span class="br0">&#40;</span>UILocalNotification <span class="sy0">*</span><span class="br0">&#41;</span>notif <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;application: didReceiveLocalNotification:&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>itemName <span class="sy0">=</span> <span class="br0">&#91;</span>notif.userInfo objectForKey<span class="sy0">:</span>ItemListKey<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>messageTitle <span class="sy0">=</span> <span class="br0">&#91;</span>notif.userInfo objectForKey<span class="sy0">:</span>MessageTitleKey<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">//&nbsp; &nbsp; &nbsp; NSLog(@&quot;itemNameeeeeeeeeeeeeeeeeee%@&quot;,ToDoItemKey);</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">//NSLog(@&quot;messageTitleeeeeeeeeeeeeeee %@&quot;,MessageTitleKey);</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">// [viewController displayItem:itemName]; // custom method </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self _showAlert<span class="sy0">:</span>itemName withTitle<span class="sy0">:</span>messageTitle<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;Receive Local Notification while the app is still running&#8230;&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;current notification is %@&quot;</span>,notif<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; application.applicationIconBadgeNumber <span class="sy0">=</span> notif.applicationIconBadgeNumber<span class="sy0">-</span><span class="nu0">1</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span> _showAlert<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a><span class="sy0">*</span><span class="br0">&#41;</span>pushmessage withTitle<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a><span class="sy0">*</span><span class="br0">&#41;</span>title<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; UIAlertView<span class="sy0">*</span> alertView <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIAlertView alloc<span class="br0">&#93;</span> initWithTitle<span class="sy0">:</span>title message<span class="sy0">:</span>pushmessage delegate<span class="sy0">:</span>self cancelButtonTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;OK&quot;</span> otherButtonTitles<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>alertView show<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>alertView<span class="br0">&#41;</span> <span class="br0">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>alertView release<span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></p>
<p>
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>scheduleNotificationWithItem<span class="sy0">:</span><span class="br0">&#40;</span>ItemList <span class="sy0">*</span><span class="br0">&#41;</span>item interval<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">int</span><span class="br0">&#41;</span>minutesBefore <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSCalendar_Class/"><span class="kw5">NSCalendar</span></a> <span class="sy0">*</span>calendar <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSCalendar_Class/"><span class="kw5">NSCalendar</span></a> autoupdatingCurrentCalendar<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDateComponents_Class/"><span class="kw5">NSDateComponents</span></a> <span class="sy0">*</span>dateComps <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDateComponents_Class/"><span class="kw5">NSDateComponents</span></a> alloc<span class="br0">&#93;</span> init<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#91;</span>dateComps setDay<span class="sy0">:</span>item.day<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#91;</span>dateComps setMonth<span class="sy0">:</span>item.month<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#91;</span>dateComps setYear<span class="sy0">:</span>item.year<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#91;</span>dateComps setHour<span class="sy0">:</span>item.hour<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#91;</span>dateComps setMinute<span class="sy0">:</span>item.minute<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span class="kw5">NSDate</span></a> <span class="sy0">*</span>itemDate <span class="sy0">=</span> <span class="br0">&#91;</span>calendar dateFromComponents<span class="sy0">:</span>dateComps<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#91;</span>dateComps release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; UILocalNotification <span class="sy0">*</span>localNotif <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UILocalNotification alloc<span class="br0">&#93;</span> init<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>localNotif <span class="sy0">==</span> <span class="kw2">nil</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span>;<br />
&nbsp; &nbsp; localNotif.fireDate <span class="sy0">=</span> <span class="br0">&#91;</span>itemDate dateByAddingTimeInterval<span class="sy0">:-</span><span class="br0">&#40;</span>minutesBefore<span class="sy0">*</span>60<span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;fireDate is %@&quot;</span>,localNotif.fireDate<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; localNotif.timeZone <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSTimeZone_Class/"><span class="kw5">NSTimeZone</span></a> defaultTimeZone<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; localNotif.alertBody <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> stringWithFormat<span class="sy0">:</span>NSLocalizedString<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;%@ in %i minutes.&quot;</span>, <span class="kw2">nil</span><span class="br0">&#41;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; item.eventName, minutesBefore<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; localNotif.alertAction <span class="sy0">=</span> NSLocalizedString<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;View Details&quot;</span>, <span class="kw2">nil</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; localNotif.soundName <span class="sy0">=</span> UILocalNotificationDefaultSoundName;<br />
&nbsp; &nbsp; localNotif.applicationIconBadgeNumber <span class="sy0">=</span> <span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">// &nbsp;NSDictionary *infoDict = [NSDictionary dictionaryWithObject:item.eventName forKey:ToDoItemKey];</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span class="kw5">NSDictionary</span></a> <span class="sy0">*</span>infoDict <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span class="kw5">NSDictionary</span></a> dictionaryWithObjectsAndKeys<span class="sy0">:</span>item.eventName,ItemListKey, <span class="co3">@</span><span class="st0">&quot;Local Push received while running&quot;</span>, MessageTitleKey, <span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; localNotif.userInfo <span class="sy0">=</span> infoDict;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="br0">&#91;</span><span class="br0">&#91;</span>UIApplication sharedApplication<span class="br0">&#93;</span> scheduleLocalNotification<span class="sy0">:</span>localNotif<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;scheduledLocalNotifications are %@&quot;</span>, <span class="br0">&#91;</span><span class="br0">&#91;</span>UIApplication sharedApplication<span class="br0">&#93;</span> scheduledLocalNotifications<span class="br0">&#93;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#91;</span>localNotif release<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span><span class="br0">&#41;</span> checkForIncomingChat <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="co3">@</span><span class="st0">&quot;javacom&quot;</span>;<br />
<span class="br0">&#125;</span>;</p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>applicationDidEnterBackground<span class="sy0">:</span><span class="br0">&#40;</span>UIApplication <span class="sy0">*</span><span class="br0">&#41;</span>application <span class="br0">&#123;</span><br />
&nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;Application entered background state.&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="co2">// UIBackgroundTaskIdentifier bgTask is instance variable</span><br />
&nbsp; &nbsp; NSAssert<span class="br0">&#40;</span>self<span class="sy0">-</span>&gt;bgTask <span class="sy0">==</span> UIBackgroundTaskInvalid, <span class="kw2">nil</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; bgTask <span class="sy0">=</span> <span class="br0">&#91;</span>application beginBackgroundTaskWithExpirationHandler<span class="sy0">:</span> <span class="sy0">^</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; dispatch_async<span class="br0">&#40;</span>dispatch_get_main_queue<span class="br0">&#40;</span><span class="br0">&#41;</span>, <span class="sy0">^</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>application endBackgroundTask<span class="sy0">:</span>self<span class="sy0">-</span>&gt;bgTask<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self<span class="sy0">-</span>&gt;bgTask <span class="sy0">=</span> UIBackgroundTaskInvalid;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; dispatch_async<span class="br0">&#40;</span>dispatch_get_main_queue<span class="br0">&#40;</span><span class="br0">&#41;</span>, <span class="sy0">^</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">while</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>application backgroundTimeRemaining<span class="br0">&#93;</span> &gt; 1.0<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>friend <span class="sy0">=</span> <span class="br0">&#91;</span>self checkForIncomingChat<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>friend<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UILocalNotification <span class="sy0">*</span>localNotif <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UILocalNotification alloc<span class="br0">&#93;</span> init<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>localNotif<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; localNotif.alertBody <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> stringWithFormat<span class="sy0">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSLocalizedString<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;%@ has a message for you.&quot;</span>, <span class="kw2">nil</span><span class="br0">&#41;</span>, friend<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; localNotif.alertAction <span class="sy0">=</span> NSLocalizedString<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;Read Msg&quot;</span>, <span class="kw2">nil</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; localNotif.soundName <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;alarmsound.caf&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; localNotif.applicationIconBadgeNumber <span class="sy0">=</span> <span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span class="kw5">NSDictionary</span></a> <span class="sy0">*</span>infoDict <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span class="kw5">NSDictionary</span></a> dictionaryWithObjectsAndKeys<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Your Background Task works&quot;</span>,ItemListKey, <span class="co3">@</span><span class="st0">&quot;Message from javacom&quot;</span>, MessageTitleKey, <span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; localNotif.userInfo <span class="sy0">=</span> infoDict;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>application presentLocalNotificationNow<span class="sy0">:</span>localNotif<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>localNotif release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; friend <span class="sy0">=</span> <span class="kw2">nil</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>application endBackgroundTask<span class="sy0">:</span>self<span class="sy0">-</span>&gt;bgTask<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; self<span class="sy0">-</span>&gt;bgTask <span class="sy0">=</span> UIBackgroundTaskInvalid;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 5:</strong> Now compile and run the application in the Simulator.</p>
<p><a href="http://edumobile.org/iphone/wp-content/uploads/2010/06/local_Notify.jpg"><img class="alignnone size-medium wp-image-2204" title="local_Notify" src="http://edumobile.org/iphone/wp-content/uploads/2010/06/local_Notify-196x300.jpg" alt="" width="196" height="300" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://edumobile.org/iphone/wp-content/uploads/2010/06/Multitusking_LocalNotify.zip'>Multitusking_LocalNotify</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/localnotification-in-iphone-os4/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>TabBarExampleDemo in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/tabbarexampledemo-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/tabbarexampledemo-in-iphone/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 05:42:25 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[iphone tutorials]]></category>
		<category><![CDATA[TabBarExampleDemo]]></category>
		<category><![CDATA[TabBarExampleDemo in iPhone]]></category>

		<guid isPermaLink="false">http://edumobile.org/iphone/?p=2187</guid>
		<description><![CDATA[In this example we will see how to work TabBarController in the Window base application.]]></description>
			<content:encoded><![CDATA[<p>In this example we will see how to work TabBarController in the Window base application.</p>
<p><strong>Step 1:</strong> Create a Window base application using template. Give the application name “TabBarController_Windowbase”.</p>
<p><strong>Step 2</strong>: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> We need to add three UIViewController in the class folder. Select classes -&gt; Add -&gt; New File -&gt; Cocoa Touch Class -&gt; select UIViewControllersubclass . Create the corresponding .xib file. Give the classes name &#8220;FirstTableViewController&#8221;,&#8221;SecondViewController&#8221; and &#8220;ThirdTableViewController&#8221;.</p>
<p><strong>Step 4:</strong> We add pList in the Resource folder. Give the PropertyList name &#8220;ThirdpList.plist&#8221;.</p>
<p><strong>Step 5:</strong> In the AppDelegate.h file, we have added UITabBarController, FirstTableViewController, ThirdTableViewController. So make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span></p>
<p><span class="kw1">@class</span> FirstTableViewController;<br />
<span class="kw1">@class</span> ThirdTableViewController;</p>
<p><span class="kw1">@interface</span> TabBarController_WindowbaseAppDelegate <span class="sy0">:</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span class="kw5">NSObject</span></a> &lt;UIApplicationDelegate&gt; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; UIWindow <span class="sy0">*</span>window;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UITabBarController <span class="sy0">*</span>rootViewController;<br />
&nbsp; &nbsp; &nbsp; &nbsp; FirstTableViewController <span class="sy0">*</span>firstTableViewController;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ThirdTableViewController <span class="sy0">*</span>thirdTableViewController;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UIWindow <span class="sy0">*</span>window;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UITabBarController <span class="sy0">*</span>rootViewController;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet FirstTableViewController <span class="sy0">*</span>firstTableViewController;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet ThirdTableViewController <span class="sy0">*</span>thirdTableViewController;</div>
</div>
<p><strong>Step 6:</strong> Double click  the MainWindow.xib file and open it to the Interface Builder. First drag the TabBarController from the library and place it to the MainWindow. Double click the TabBarController from the MainWindow and open it. Now drag the  TabBar Item from the library and place it to the TabBarController window. Select the ViewController from the TabBar Controller and bring up Identity Inspector and change the class name into FirstTableViewController, and bring up Attribute Inspector, load the FirstTableViewController NIB file. Select the Next ViewController from the TabBar Controller, and bring up Identity Inspector change the class name into SecondViewController, after doing that bring up Attributes Inspector and load the SecondViewController NIB file. Select another ViewController from the Tab Bar Controller and bring up Identity Inspector  and change the class name into ThirdTableViewController , after doing that bring up Attributes Inspector and load the ThirdTableViewController NIB file. Now drag Tab Bar Controller Windowbase App Delegate icon to the Tab Bar Controller icon and select rootViewController. Now save the MainWindow.xib file, close it and go back to the Xcode.</p>
<p><strong>Step 7: </strong>Open the AppDelegate.m file and make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>application<span class="sy0">:</span><span class="br0">&#40;</span>UIApplication <span class="sy0">*</span><span class="br0">&#41;</span>application didFinishLaunchingWithOptions<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span class="kw5">NSDictionary</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>launchOptions <span class="br0">&#123;</span> &nbsp; &nbsp;<br />
&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>window addSubview<span class="sy0">:</span>rootViewController.view<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="br0">&#91;</span>window makeKeyAndVisible<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">YES</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 8: </strong>In the FirstTableViewController.h file, we have added  UITableView and NSMutableArray. So make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span><br />
<span class="co1">#import &quot;FirstTableViewController.h&quot;</span><br />
<span class="co1">#import &quot;ThirdTableViewController.h&quot;</span></p>
<p>
<span class="kw1">@interface</span> FirstTableViewController <span class="sy0">:</span> UITableViewController &lt;UITableViewDelegate, UITableViewDataSource&gt;<br />
<span class="br0">&#123;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; IBOutlet UITableView <span class="sy0">*</span>firstTableView;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/"><span class="kw5">NSMutableArray</span></a> <span class="sy0">*</span>firstScreen;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/"><span class="kw5">NSMutableArray</span></a> <span class="sy0">*</span>firstScreen;</div>
</div>
<p><strong>Step 9:</strong> Double click the FirstTableViewController.xib file and open it to the Interface Builder.First drag the TableView from the library and place it to the view window. Select the TableView from the view window and bring up Connection Inspector, connect dataSource to the File Owner icon and delegate to the File Owner icon. Connect File&#8217;s Owner icon to the Table view and select firstTableView. Select the File&#8217;s Owner icon from the mainwindow and bring up Connection Inspector and connect view to the Table View. You have done all the connection, now save the FirstTableViewController.xib file,close it and go back to the Xcode.</p>
<p><strong>Step 10: </strong>Open the FirstTableViewController.m file and make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/"><span class="kw5">NSMutableArray</span></a> <span class="sy0">*</span>array <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> alloc<span class="br0">&#93;</span> initWithObjects<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Select Item2&quot;</span>, <span class="co3">@</span><span class="st0">&quot;Select Item3&quot;</span>, <span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.firstScreen <span class="sy0">=</span> array;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>array release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>numberOfSectionsInTableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">1</span>;<br />
<span class="br0">&#125;</span></p>
<p>
<span class="co2">// Customize the number of rows in the table view.</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>tableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView numberOfRowsInSection<span class="sy0">:</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>section <br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="br0">&#91;</span>self.firstScreen count<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p>
<span class="co2">// Customize the appearance of table view cells.</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>UITableViewCell <span class="sy0">*</span><span class="br0">&#41;</span>tableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView cellForRowAtIndexPath<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span class="kw5">NSIndexPath</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>indexPath <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw4">static</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>CellIdentifier <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;Cell&quot;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; UITableViewCell <span class="sy0">*</span>cell <span class="sy0">=</span> <span class="br0">&#91;</span>tableView dequeueReusableCellWithIdentifier<span class="sy0">:</span>CellIdentifier<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>cell <span class="sy0">==</span> <span class="kw2">nil</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; cell <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UITableViewCell alloc<span class="br0">&#93;</span> initWithStyle<span class="sy0">:</span>UITableViewCellStyleDefault reuseIdentifier<span class="sy0">:</span>CellIdentifier<span class="br0">&#93;</span> autorelease<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="co2">// Set up the cell&#8230;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NSUInteger row <span class="sy0">=</span> <span class="br0">&#91;</span>indexPath row<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cell.textLabel.text <span class="sy0">=</span> <span class="br0">&#91;</span>firstScreen objectAtIndex<span class="sy0">:</span>row<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">return</span> cell;<br />
<span class="br0">&#125;</span></p>
<p>
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>tableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView didSelectRowAtIndexPath<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span class="kw5">NSIndexPath</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>indexPath <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span><span class="br0">&#91;</span>firstScreen objectAtIndex<span class="sy0">:</span>indexPath.row<span class="br0">&#93;</span> isEqual<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Select Item2&quot;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.tabBarController.selectedIndex <span class="sy0">=</span> <span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span><span class="br0">&#91;</span>firstScreen objectAtIndex<span class="sy0">:</span>indexPath.row<span class="br0">&#93;</span> isEqual<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Select Item3&quot;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.tabBarController.selectedIndex <span class="sy0">=</span> <span class="nu0">2</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 11:</strong>Double click the SecondViewController.xib file  and open it to the Interface Builder. Select the view window and bring up Attribute Inspector,and change the background color. Connect File&#8217;s Owner icon to the View icon and select view.</p>
<p><strong>Step 12: </strong>In the ThirdTableViewController.h file, we have added UITableView, and NSMutableArray. So make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span><br />
<span class="kw1">@interface</span> ThirdTableViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; IBOutlet UITableView <span class="sy0">*</span>thirdTableView;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/"><span class="kw5">NSMutableArray</span></a> <span class="sy0">*</span>thirdScreenList;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/"><span class="kw5">NSMutableArray</span></a> <span class="sy0">*</span>thirdScreenList;</div>
</div>
<p><strong>Step 13: </strong>Double click the ThirdTableViewController.xib file and open it to the Interface Builder. First drag the TableView from the library and place it to the view window. Select the TableView from the view window and bring up Connection Inspector, connect dataSource to the File Owner icon and delegate to the File Owner icon. Connect File&#8217;s Owner icon to the Table view and select thirdTableView. Select the File&#8217;s Owner icon from the mainwindow and bring up Connection Inspector and connect view to the Table View. You have done all the connection, now save the ThirdTableViewController.xib file,close it and go back to the Xcode.</p>
<p><strong>Step 14:</strong> Open the ThirdTableViewController.m file and make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>myfile <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span class="kw5">NSBundle</span></a> mainBundle<span class="br0">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pathForResource<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;ThirdpList&quot;</span>ofType<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;plist&quot;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/"><span class="kw5">NSMutableArray</span></a> <span class="sy0">*</span>array <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> alloc<span class="br0">&#93;</span> initWithContentsOfFile<span class="sy0">:</span>myfile<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.thirdScreenList <span class="sy0">=</span> array;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>array release<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>numberOfSectionsInTableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">1</span>;<br />
<span class="br0">&#125;</span></p>
<p>
<span class="co2">// Customize the number of rows in the table view.</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>tableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView numberOfRowsInSection<span class="sy0">:</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>section <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw1">return</span> <span class="br0">&#91;</span>self.thirdScreenList count<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p>
<span class="co2">// Customize the appearance of table view cells.</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>UITableViewCell <span class="sy0">*</span><span class="br0">&#41;</span>tableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView cellForRowAtIndexPath<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span class="kw5">NSIndexPath</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>indexPath <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw4">static</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>CellIdentifier <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;Cell&quot;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; UITableViewCell <span class="sy0">*</span>cell <span class="sy0">=</span> <span class="br0">&#91;</span>tableView dequeueReusableCellWithIdentifier<span class="sy0">:</span>CellIdentifier<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>cell <span class="sy0">==</span> <span class="kw2">nil</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; cell <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UITableViewCell alloc<span class="br0">&#93;</span> initWithStyle<span class="sy0">:</span>UITableViewCellStyleDefault reuseIdentifier<span class="sy0">:</span>CellIdentifier<span class="br0">&#93;</span> autorelease<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="co2">// Set up the cell&#8230;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NSUInteger row <span class="sy0">=</span> <span class="br0">&#91;</span>indexPath row<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cell.textLabel.text <span class="sy0">=</span> <span class="br0">&#91;</span>thirdScreenList objectAtIndex<span class="sy0">:</span>row<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">return</span> cell;<br />
<span class="br0">&#125;</span></p>
<p>
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>tableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView didSelectRowAtIndexPath<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span class="kw5">NSIndexPath</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>indexPath <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</div>
<p><strong>Step 15:</strong> Double click the MainWindow.xib file and open it to the Interface Builder. Connect the Tab bar Controller Windowbase App Delegate to the FirstTableViewController and select firstTableView. Do the same thing for the ThirdTableViewController and select secondTableView. Now save the MainWindow.xib file, close it and go back to the Xcode.</p>
<p><strong>Step 16:</strong> Now compile and run the application in the Simulator.</p>
<p><a href="http://edumobile.org/iphone/wp-content/uploads/2010/06/123.jpg"><img src="http://edumobile.org/iphone/wp-content/uploads/2010/06/123-155x300.jpg" alt="" title="123" width="155" height="300" class="alignnone size-medium wp-image-2193" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://edumobile.org/iphone/wp-content/uploads/2010/06/TabBarController_Windowbase1.zip'>TabBarController_Windowbase</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/tabbarexampledemo-in-iphone/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Draw Rectangle In Window Base Application</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/how-to-draw-rectangle-in-window-base-application/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/how-to-draw-rectangle-in-window-base-application/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 07:49:50 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[Draw Rectangle]]></category>
		<category><![CDATA[How to Draw Rectangle In Window Base Application]]></category>
		<category><![CDATA[iphone tutorials]]></category>

		<guid isPermaLink="false">http://edumobile.org/iphone/?p=2171</guid>
		<description><![CDATA[This is the Simple Example. In this example we will see how to draw rectangle in the window base application.]]></description>
			<content:encoded><![CDATA[<p>This is the Simple Example. In this example we will see how to draw rectangle in the window base application.</p>
<p><strong>Step 1: </strong>Create a Window base application using template. Give the application name “RectDraw”.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3: </strong>Open the RectDrawAppDelegate.m file and make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>application<span class="sy0">:</span><span class="br0">&#40;</span>UIApplication <span class="sy0">*</span><span class="br0">&#41;</span>application didFinishLaunchingWithOptions<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span class="kw5">NSDictionary</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>launchOptions <span class="br0">&#123;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;window.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor blackColor<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; CGRect redFrame <span class="sy0">=</span> CGRectMake<span class="br0">&#40;</span>20, 20, 100, 100<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIView <span class="sy0">*</span>redView <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIView alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span>redFrame<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; redView.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor redColor<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>window addSubview<span class="sy0">:</span>redView<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>redView release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; CGRect yellowFrame <span class="sy0">=</span> CGRectMake<span class="br0">&#40;</span>120, 120, 100, 100<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIView <span class="sy0">*</span>yellowView <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIView alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span>yellowFrame<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; yellowView.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor yellowColor<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>window addSubview<span class="sy0">:</span>yellowView<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>yellowView release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; CGRect blueFrame <span class="sy0">=</span> CGRectMake<span class="br0">&#40;</span>220, 220, 100, 100<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIView <span class="sy0">*</span>blueView <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIView alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span>blueFrame<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; blueView.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor blueColor<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>window addSubview<span class="sy0">:</span>blueView<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>blueView release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>window makeKeyAndVisible<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">YES</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 4:</strong> Now compile and run the application in the Simulator.</p>
<p><a href="http://edumobile.org/iphone/wp-content/uploads/2010/06/1-5.jpg"><img src="http://edumobile.org/iphone/wp-content/uploads/2010/06/1-5-173x300.jpg" alt="" title="1-5" width="173" height="300" class="alignnone size-medium wp-image-2174" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://edumobile.org/iphone/wp-content/uploads/2010/06/RectDraw1.zip'>RectDraw</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/how-to-draw-rectangle-in-window-base-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iPhone Cash! &#8211; Learn iPhone Development and Make Tons!</title>
		<link>http://www.edumobile.org/iphone/edumobile-news/iphone-cash-learn-iphone-development-and-make-tons/</link>
		<comments>http://www.edumobile.org/iphone/edumobile-news/iphone-cash-learn-iphone-development-and-make-tons/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 09:06:17 +0000</pubDate>
		<dc:creator>vishy</dc:creator>
				<category><![CDATA[EDUmobile News]]></category>
		<category><![CDATA[how to program iphone]]></category>
		<category><![CDATA[iphone training]]></category>
		<category><![CDATA[iphone tutorials]]></category>
		<category><![CDATA[learn iphone development]]></category>
		<category><![CDATA[learn iphone programming]]></category>

		<guid isPermaLink="false">http://edumobile.org/iphone/?p=4</guid>
		<description><![CDATA[There is a lot of buzz about some independent developers and newbies who have made between $100,000 to $500,000 by simply creating their first iPhone application and putting it up for sale on the online Apple Store. Steve Demeter made a simple puzzle game called Trism, and in 2 months he earned $250,000.]]></description>
			<content:encoded><![CDATA[<p>There is a lot of buzz about some independent developers and newbies who have made between $100,000 to $500,000 by simply creating their first iPhone application and putting it up for sale on the online Apple Store.</p>
<p>Steve Demeter made a simple puzzle game called Trism, and in 2 months he earned $250,000. Last December the app called iFart became the number one app on the App Store. It stayed on the top and raked in $9200 each day in profit after Apple’s cut. Then, Ethan Nicholas, developer of the now famous iShoot game, earns $21,000 per day selling his iPhone app. Ethan quit his day job to work full time on the iPhone and he did not even know how to write Objective-C code before he made iShoot.</p>
<p>These are just some of the stories that are causing  a lot of buzz, and people have quit their day jobs to cash in on the opportunity.</p>
<p>However, developing for the iPhone is relatively a new field with a shortage of well structured tutorials and one-on-one mentorship and help. EDUmobile.ORG has been involved with online training in the wireless technology programming field and has launched its iPhone Online Course to meet the shortage of information resources and training.</p>
<p>The course is offered on a once a week basis via Online Video, PDF Documents, One-on-One sessions and Weekly Worksheets. There is also an option to access a remote Mac, for those who do not have access to one.</p>
<p>The iPhone course offered at EDUmobile.ORG is crafted to suite the industry need for beginner and intermediate level developers. After the course completion, developers will be able to create software for iPhone and can optionally  distribute their content through EDUmobile.ORG on the online App Store, and immediately start earning. One can also bid to win the large number of growing projects being posted daily on project bidding sites like Elance and RentACoder.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/edumobile-news/iphone-cash-learn-iphone-development-and-make-tons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

