<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>iPhone Tutorial | iPhone iOS4 iPad SDK Development &amp; Programming Blog</title>
	
	<link>http://www.edumobile.org/iphone</link>
	<description />
	<lastBuildDate>Thu, 24 May 2012 11:17:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/TheIphoneDeveloperResource" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="theiphonedeveloperresource" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Using Touch Handlers in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-apps/using-touch-handlers-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-apps/using-touch-handlers-in-iphone/#comments</comments>
		<pubDate>Thu, 24 May 2012 10:05:36 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Apps]]></category>
		<category><![CDATA[iPhone Beginner Tutorials]]></category>
		<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[free iphone code]]></category>
		<category><![CDATA[free iPhone programming]]></category>
		<category><![CDATA[free iPhone training]]></category>
		<category><![CDATA[iPhone classes]]></category>
		<category><![CDATA[iPhone free tutorials]]></category>
		<category><![CDATA[iPhone Using Touch Handlers]]></category>
		<category><![CDATA[Using Touch Handlers]]></category>
		<category><![CDATA[Using Touch Handlers in iPhone]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3512</guid>
		<description><![CDATA[Prior to the release of Xcode version 4, managing touch gestures in iOS was done programmatically. Since version 4, we have the ability to create touch handlers directly in Interface Builder. These touch handlers can then be assigned methods like any other active control. So, let&#8217;s see how it works!
Start up Xcode, select “Create a [...]]]></description>
			<content:encoded><![CDATA[<p>Prior to the release of Xcode version 4, managing touch gestures in iOS was done programmatically. Since version 4, we have the ability to create touch handlers directly in Interface Builder. These touch handlers can then be assigned methods like any other active control. So, let&#8217;s see how it works!</p>
<p>Start up Xcode, select “Create a new Xcode project,” choose the Single View Application template, and name your project “TouchHandlers.” Use the settings shown below:</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/ProjectSettings.png"><img class="alignnone size-full wp-image-3517" title="ProjectSettings" src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/ProjectSettings.png" alt="" width="531" height="373" /></a></p>
<p>Click Next, choose a location to save your project, and click Create.</p>
<p>In the Project Navigator, select the MainStoryboard.storyboard file, which will bring up the storyboard in Interface Builder. Drag a UILabel control from the library to the view, and change the text of the label to “Tap once for red, twice for blue.” Resize and center the label as shown:</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/ConfigLabel.png"><img class="alignnone size-full wp-image-3513" title="ConfigLabel" src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/ConfigLabel.png" alt="" width="353" height="184" /></a></p>
<p>Now drag a Tap Gesture Recognizer (UITapGestureRecognizer) from the library to the view. The Tap Gesture Recognizer is located in the library:</p>
<p>Notice that when you drag the tap gesture recognizer<a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/GestureRecognizer.png"><img class="alignright size-full wp-image-3514" title="GestureRecognizer" src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/GestureRecognizer.png" alt="" width="287" height="65" /></a> to the view, it becomes a child of the view controller rather than the view. We need to create an action method to handle the tap gesture when it occurs.</p>
<p>Since we want to detect not only a single tap, but also a double tap, we will need two tap gesture recognizer objects, so drag another one out now. For the first recognizer, leave all the attributes alone, but for the second, change the Taps attribute to 2 as shown:</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/SettingTaps.png"><img class="alignleft size-full wp-image-3518" title="SettingTaps" src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/SettingTaps.png" alt="" width="268" height="91" /></a>Now we&#8217;re ready to create the action methods to be executed in response to the tap gestures. Open up the ViewController.h file, and add the bolded in the listing below:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &amp;lt;UIKit/UIKit.h&amp;gt;</span><br />
<span class="kw1">@interface</span> ViewController <span class="sy0">:</span> UIViewController<br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>singleTap<span class="sy0">:</span><span class="br0">&#40;</span>UITapGestureRecognizer <span class="sy0">*</span><span class="br0">&#41;</span>sender;<br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>doubleTap<span class="sy0">:</span><span class="br0">&#40;</span>UITapGestureRecognizer <span class="sy0">*</span><span class="br0">&#41;</span>sender;<br />
<span class="kw1">@end</span></div>
</div>
<p>Now open ViewController.m and add the bolded methods shown here:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;ViewController.h&quot;</span><br />
<span class="kw1">@interface</span> ViewController <span class="br0">&#40;</span><span class="br0">&#41;</span><br />
<span class="kw1">@end</span><br />
<span class="kw1">@implementation</span> ViewController<br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>singleTap<span class="sy0">:</span><span class="br0">&#40;</span>UITapGestureRecognizer <span class="sy0">*</span><span class="br0">&#41;</span>sender<br />
<span class="br0">&#123;</span><br />
self.view.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor redColor<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>doubleTap<span class="sy0">:</span><span class="br0">&#40;</span>UITapGestureRecognizer <span class="sy0">*</span><span class="br0">&#41;</span>sender<br />
<span class="br0">&#123;</span><br />
self.view.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor blueColor<span class="br0">&#93;</span>;<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>viewDidLoad<br />
&#8230;</div>
</div>
<p>All that remains is to wire up the methods to the proper gesture recognizers in Interface Builder. Make sure that singleTap is wired to the recognizer configured for 1 tap and doubleTap is wired to the one configured for 2 taps.</p>
<p>Run the application to test the tap gestures.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/NoTaps.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/NoTaps-152x300.png" alt="" title="NoTaps" width="152" height="300" class="alignnone size-medium wp-image-3515" /></a></p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/OneTap.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/OneTap-152x300.png" alt="" title="OneTap" width="152" height="300" class="alignnone size-medium wp-image-3516" /></a></p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/TwoTaps.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/TwoTaps-152x300.png" alt="" title="TwoTaps" width="152" height="300" class="alignnone size-medium wp-image-3519" /></a><br />
There are many other gesture recognizers available in the Interface Builder library. Have fun experimenting will all of them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-apps/using-touch-handlers-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Simple Web Browser for iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-apps/a-simple-web-browser-for-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-apps/a-simple-web-browser-for-iphone/#comments</comments>
		<pubDate>Tue, 22 May 2012 10:10:21 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Apps]]></category>
		<category><![CDATA[iPhone Beginner Tutorials]]></category>
		<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[A Simple Web Browser]]></category>
		<category><![CDATA[A Simple Web Browser for iPhone]]></category>
		<category><![CDATA[free iPhone course]]></category>
		<category><![CDATA[free iPhone tutorials]]></category>
		<category><![CDATA[iPhone classes]]></category>
		<category><![CDATA[iphone training]]></category>
		<category><![CDATA[Web Browser for iPhone]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3531</guid>
		<description><![CDATA[	In this blog, we&#8217;ll learn how to use a UITextField in conjunction with a UIWebView to create a very simple web browser application. Using this technique as a foundation, you can build rather powerful web – based applications. So, let&#8217;s get started!
	Open Xcode, and choose “Create a new Xcode project” from the welcome screen. In [...]]]></description>
			<content:encoded><![CDATA[<p>	In this blog, we&#8217;ll learn how to use a UITextField in conjunction with a UIWebView to create a very simple web browser application. Using this technique as a foundation, you can build rather powerful web – based applications. So, let&#8217;s get started!</p>
<p>	Open Xcode, and choose “Create a new Xcode project” from the welcome screen. In the next screen, choose the Single View Application template. Name your project “SimpleBrowser” and choose options as shown:</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/Image001.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/Image001.png" alt="" title="Image001" width="429" height="290" class="alignnone size-full wp-image-3532" /></a></p>
<p>Click Next, choose a location to save the project, and Click Create. Once the project has been created, select the MainStoryboard.storyboard file. Drag a UILabel, UITextField, and UIWebView to the View as shown:</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/Image002.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/Image002.png" alt="" title="Image002" width="387" height="570" class="alignnone size-full wp-image-3533" /></a></p>
<p>	Open the ViewController.h file, and make the changes as shown:</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> ViewController <span class="sy0">:</span> UIViewController</p>
<p><span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, strong<span class="br0">&#41;</span> IBOutlet UITextField <span class="sy0">*</span>address;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, strong<span class="br0">&#41;</span> IBOutlet UIWebView <span class="sy0">*</span>browser;</p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>addressEntered<span class="sy0">:</span><span class="br0">&#40;</span>UITextField <span class="sy0">*</span><span class="br0">&#41;</span>sender;</p>
<p><span class="kw1">@end</span></div>
</div>
<p>	We&#8217;ve added two properties, a UITextField named address, and a UIWebView named browser. Both of these properties are designated as IBOutlets, which means that they will be wired up to controls in our view. We&#8217;ve also added an action method (addressEntered:) that will also be wired up to a control. </p>
<p>	Next, open up the ViewController.m file, and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;ViewController.h&quot;</span></p>
<p><span class="kw1">@interface</span> ViewController <span class="br0">&#40;</span><span class="br0">&#41;</span></p>
<p><span class="kw1">@end</span></p>
<p><span class="kw1">@implementation</span> ViewController</p>
<p><span class="kw1">@synthesize</span> address;<br />
<span class="kw1">@synthesize</span> browser;</p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> addressEntered<span class="sy0">:</span><span class="br0">&#40;</span>UITextField <span class="sy0">*</span><span class="br0">&#41;</span>sender<br />
<span class="br0">&#123;</span><br />
&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>sender.text<span class="br0">&#93;</span>;<br />
&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>request <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; <span class="br0">&#91;</span>self.browser loadRequest<span class="sy0">:</span>request<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; self.browser.scalesPageToFit <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; <span class="br0">&#91;</span>sender resignFirstResponder<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>viewDidLoad<br />
<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; <span class="co2">// Do any additional setup after loading the view, typically from a nib.</span><br />
<span class="br0">&#125;</span><br />
…</div>
</div>
<p>	As is usually the case with properties declared in the .h file, we first synthesize them here. Next comes the implementation of the addressEntered: method. Notice that the sender of the event that triggers this method is a UITextField: the same text field we dragged to the view in the MainStoryboard.storyboard file earlier. In this method, we obtain the text from the sender, and make it into an NSURL object called url. Then we create an NSURLRequest object called request, using the url we just created. </p>
<p>	The next step is to load the NSURLRequest into the browser using the loadRequest: method of UIWebView. This will load the web site specified into the web view. We make an attempt to scale the page to fit in the browser view; some pages can be scaled, others cannot. If the page cannot be scaled, this line will fail silently.</p>
<p>	The last step in the method is to call resignFirstResponder on the sender. This will hide the keyboard associated with the text field, so the browser will not be obscured. All that now remains is to wire up the properties and the method to their corresponding controls.</p>
<p>	Re – open the MainStoryboard.storyboard file, and right – click the View Controller object. Drag from the circle to the right of the address outlet to the UITextField, and from the circle to the right of the browser outlet to the UIWebView. Also drag from the circle to the right of the addressEntered received action to the UITextField; in the resulting popup, choose Did End On Exit. Finally, in the Attributes inspector for the text field, set the Return Key type to “Done,” as shown:</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/Image003.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/Image003.png" alt="" title="Image003" width="268" height="172" class="alignnone size-full wp-image-3534" /></a></p>
<p>	With all of the controls wired up, we should now be able to run the application successfully. Do so, and in the text field, enter http://www.google.com (for example). Note that this simple browser requires a well formed URL to be entered: we cannot just enter “google.com” for example: the full string must be present. </p>
<p>	Since a UIWebView is scrollable, it is possible to<a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/Image004.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/Image004.png" alt="" title="Image004" width="162" height="249" class="alignright size-full wp-image-3535" /></a> use drag and swipe gestures to scroll a web page both horizontally and vertically with no additional coding. Also, if the web page is resizable, pinch gestures may be used to do so. </p>
<p>Take a look at the class reference for the UIWebView, and have fun enhancing this very simple browser application. </p>
<p></br><br />
<br /></br><br />
<br /></br></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-apps/a-simple-web-browser-for-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ButtonHide Example in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-apps/buttonhide-example-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-apps/buttonhide-example-in-iphone/#comments</comments>
		<pubDate>Thu, 17 May 2012 10:51:59 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Apps]]></category>
		<category><![CDATA[iPhone Beginner Tutorials]]></category>
		<category><![CDATA[iPhone Game Programming]]></category>
		<category><![CDATA[buttonhide example in iphone]]></category>
		<category><![CDATA[buttonhide in iphone]]></category>
		<category><![CDATA[iPhon app development]]></category>
		<category><![CDATA[iphone development]]></category>
		<category><![CDATA[iPhone programming]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3504</guid>
		<description><![CDATA[In this application we will see how to hide button from the iPhone application. So let see how it will
worked.
My last post you can find out from here (attached the previous post link)
Step 1: Open the Xcode, Create a new project using Single View Application. Give the application
“ButtonHide”.
Step 2: Need to add new viewController class [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to hide button from the iPhone application. So let see how it will<br />
worked.</p>
<p>My last post you can find out from here (attached the previous post link)</p>
<p>Step 1: Open the Xcode, Create a new project using Single View Application. Give the application<br />
“ButtonHide”.</p>
<p>Step 2: Need to add new viewController class in the project. Select project -&gt; New file -&gt;<br />
UIViewController subclass -&gt; next -&gt; Give the application name “ButtonHideView”.</p>
<p>Step 3: Now open the AppDelegate.h file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import</span></p>
<p><span class="kw1">@class</span> ButtonHideView;</p>
<p><span class="kw1">@interface</span> AppDelegate <span class="sy0">:</span> UIResponder<br />
<span class="br0">&#123;</span><br />
ButtonHideView <span class="sy0">*</span>buttonHideView;<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 ButtonHideView <span class="sy0">*</span>buttonHideView;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>strong, nonatomic<span class="br0">&#41;</span> UIWindow <span class="sy0">*</span>window;</p>
<p><span class="kw1">@end</span></div>
</div>
<p>Step 4: In the AppDelegate.m file make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;AppDelegate.h&quot;</span><br />
<span class="co1">#import &quot;ButtonHideView.h&quot;</span></p>
<p><span class="kw1">@implementation</span> AppDelegate</p>
<p><span class="kw1">@synthesize</span> window <span class="sy0">=</span> _window,buttonHideView;</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><br />
<span class="sy0">*</span><span class="br0">&#41;</span>launchOptions<br />
<span class="br0">&#123;</span><br />
self.window <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIWindow alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UIScreen mainScreen<span class="br0">&#93;</span> bounds<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
<span class="co2">// Override point for customization after application launch.</span><br />
self.window.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor whiteColor<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.window makeKeyAndVisible<span class="br0">&#93;</span>;</p>
<p>buttonHideView <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>ButtonHideView alloc<span class="br0">&#93;</span><br />
initWithNibName<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;ButtonHideView&quot;</span><br />
bundle<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>_window addSubview<span class="sy0">:</span>buttonHideView.view<span class="br0">&#93;</span>;</p>
<p><span class="kw1">return</span> <span class="kw2">YES</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@end</span></div>
</div>
<p>Step 5: Now open the “ButtonHideView.h” file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import</span></p>
<p><span class="kw1">@interface</span> ButtonHideView <span class="sy0">:</span> UIViewController<br />
<span class="br0">&#123;</span><br />
IBOutlet UIButton <span class="sy0">*</span>button1;<br />
IBOutlet UITextField <span class="sy0">*</span>textfield1;</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> IBOutlet UIButton <span class="sy0">*</span>button1;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UITextField <span class="sy0">*</span>textfield1;</p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> ButtonHide<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender;<br />
<span class="co2">//}</span></p>
<p><span class="kw1">@end</span></div>
</div>
<p>Step 6: Double click the ButtonHideView.xib file and open it to the Interface Builder. First drag the<br />
UIButton and UITextField from the library and place it to the view window. Select the button from<br />
the view window and bring up connection inspector and connect touch up inside to the File&#8217;s Owner<br />
icon and select “ButtonHide:” method and connect the File&#8217;s owner icon to the textfield and select<br />
“textfield1”. Now save the .xib file, close it and go back to the Xcode.</p>
<p>Step 7: In the ButtonHideView.m file make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;ButtonHideView.h&quot;</span></p>
<p><span class="kw1">@implementation</span> ButtonHideView</p>
<p><span class="kw1">@synthesize</span> button1,textfield1;</p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>initWithNibName<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>nibNameOrNil bundle<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span class="kw5">NSBundle</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>nibBundleOrNil<br />
<span class="br0">&#123;</span><br />
self <span class="sy0">=</span> <span class="br0">&#91;</span>super initWithNibName<span class="sy0">:</span>nibNameOrNil bundle<span class="sy0">:</span>nibBundleOrNil<span class="br0">&#93;</span>;<br />
<span class="kw1">if</span> <span class="br0">&#40;</span>self<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
<span class="co2">// Custom initialization</span><br />
<span class="br0">&#125;</span><br />
<span class="kw1">return</span> self;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> ButtonHide<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender<br />
<span class="br0">&#123;</span><br />
<span class="kw1">if</span><span class="br0">&#40;</span><span class="br0">&#91;</span>textfield1.text isEqualToString<span class="sy0">:</span> <span class="co3">@</span><span class="st0">&quot;&quot;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
button1.hidden <span class="sy0">=</span> <span class="kw2">YES</span>;</p>
<p><span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
button1.hidden <span class="sy0">=</span> <span class="kw2">NO</span>;</p>
<p><span class="br0">&#125;</span><br />
NSLog<span class="br0">&#40;</span> <span class="co3">@</span><span class="st0">&quot;%@&quot;</span>, textfield1.text <span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@end</span></div>
</div>
<p>Step 8: Now Compile and run the application on the Simulator.<br />
<a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/Button_hide11.jpg"><img class="alignnone size-medium wp-image-3506" title="Button_hide1" src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/Button_hide11-162x300.jpg" alt="" width="162" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-apps/buttonhide-example-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the Empty Template in iPad</title>
		<link>http://www.edumobile.org/iphone/ipad-development/using-the-empty-template-in-ipad/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/using-the-empty-template-in-ipad/#comments</comments>
		<pubDate>Wed, 09 May 2012 07:39:58 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[empty template]]></category>
		<category><![CDATA[iPad application]]></category>
		<category><![CDATA[ipad programming]]></category>
		<category><![CDATA[iPad tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3489</guid>
		<description><![CDATA[Xcode offers many templates from which to choose when creating a new application. Sometimes,
though, we want a bit more control over the details of an app than these templates can provide; for this
reason, Xcode also offers an Empty application template. In this blog, we&#8217;ll see how to use the Empty
template to build a simple application. [...]]]></description>
			<content:encoded><![CDATA[<p>Xcode offers many templates from which to choose when creating a new application. Sometimes,<br />
though, we want a bit more control over the details of an app than these templates can provide; for this<br />
reason, Xcode also offers an Empty application template. In this blog, we&#8217;ll see how to use the Empty<br />
template to build a simple application. So let&#8217;s get started!</p>
<p>Start up Xcode and select “Create a new Xcode project.” In the next screen, choose Empty Application,<br />
then click next:</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/ChooseTemplate.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/ChooseTemplate.png" alt="" title="ChooseTemplate" width="131" height="97" class="aligncenter size-full wp-image-3490" /></a></p>
<p>In the following screen, name the project EmptyApp, select the options shown. Note that even though<br />
we are developing here for iPad, the principles involved are the same for iPhone development.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/ProjectOptions1.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/ProjectOptions1-300x202.png" alt="" title="ProjectOptions" width="400" height="252" class="aligncenter size-medium wp-image-3495" /></a></p>
<p>Click Next, choose a location to save the project, and click Create.</p>
<p>The first thing to notice about the Empty application<a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/NavigatorOne.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/NavigatorOne.png" alt="" title="NavigatorOne" width="262" height="157" class="alignright size-full wp-image-3493" /></a><br />
template is that it provides the AppDelegate class, but<br />
nothing else. We will need to provide our own view<br />
controller and view for the application.</p>
<p>In the menu, select File | New ► then File&#8230; In the next<br />
window, choose Objective – C Class, then click Next. In<br />
the window that results, name your new class<br />
MainViewController, make it an instance of<br />
UIViewController, select the checkbox next to “Targeted<br />
for iPad,” and make sure the “With XIB for user interface” check box is unchecked. (We&#8217;re going to<br />
create the xib file separately in this case to show how a view is connected to a view controller.) Click<br />
Next. Choose the default location to save the files, and click Create.</p>
<p>Now we&#8217;ll create the actual view. Another way to add a new file to the application is to right-click in<br />
the Project Navigator and select New File&#8230; from the popup menu. Do so now. In the resulting window,<br />
choose “User Interface” from the list to the left under iOS, then select the Empty document as shown<br />
here:</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/MakingXIBFile.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/MakingXIBFile-300x202.png" alt="" title="MakingXIBFile" width="400" height="252" class="aligncenter size-medium wp-image-3492" /></a></p>
<p>Click Next, and make sure the Device Family is set to “iPad.” Click Next once again, and in the Save<br />
As text box, enter “MainView.” Click Create to save the file in the default location.</p>
<p>The Project Navigator panel should now appear as shown<a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/NavigatorTwo.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/NavigatorTwo.png" alt="" title="NavigatorTwo" width="260" height="207" class="alignright size-full wp-image-3494" /></a><br />
here. Note that you may have to drag some files around in the Navigator to properly organize them. Sometimes, Xcode will crash when dragging files – this is a known issue; simply reopen Xcode and continue when this happens.</p>
<p>Select the xib file to open it in Interface Builder. You will see an entirely empty Window. First, select the File&#8217;s Owner object. In the Identity Inspector, choose MainViewController for the File&#8217;s Owner&#8217;s class, as shown below. This will make the MainViewController class the view controller for the view that we will be adding to this xib file.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/FilesOwnersClass.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/FilesOwnersClass.png" alt="" title="FilesOwnersClass" width="261" height="121" class="alignleft size-full wp-image-3491" /></a>Next, drag a UIView object from the Library to the<br />
Interface Builder surface. Notice that the UIView<br />
object is properly sized for the iPad device, because<br />
we made the iPad selection in the Device Family<br />
drop down when we created the xib file. Give the<br />
view a nice background color.</p>
<p>Now right-click the File&#8217;s Owner object, and drag<br />
from the circle to the right of the “View” item to the view itself. This makes the new UIView object the<br />
MainViewController&#8217;s view. At this point, we&#8217;re done with Interface Builder (for now).</p>
<p>We need to make this view a subview of the application&#8217;s window object, so it can be displayed when<br />
the app runs. Select the AppDelegate.h file, and make the changes shown in<strong> bold:</strong></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;MainViewController.h&quot;</span><br />
<span class="kw1">@interface</span> AppDelegate <span class="sy0">:</span> UIResponder &lt;UIApplicationDelegate&gt;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>strong, nonatomic<span class="br0">&#41;</span> UIWindow <span class="sy0">*</span>window;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>strong, nonatomic<span class="br0">&#41;</span> MainViewController <span class="sy0">*</span>mainViewController;<br />
<span class="kw1">@end</span></div>
</div>
<p>We&#8217;ve imported the MainViewController.h file (to obtain access to that object), and also set up a<br />
property of type MainViewController called mainViewController. We will instantiate this object in<br />
the .m file, then add it&#8217;s view as a subview of the window object.</p>
<p>Open up the AppDelegate.m file, and once again make the bolded changes. (The listing is on the next<br />
page:)</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;AppDelegate.h&quot;</span><br />
<span class="kw1">@implementation</span> AppDelegate<br />
<span class="kw1">@synthesize</span> window <span class="sy0">=</span> _window;<br />
<span class="kw1">@synthesize</span> mainViewController <span class="sy0">=</span> _mainViewController;<br />
<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><br />
<span class="sy0">*</span><span class="br0">&#41;</span>launchOptions<br />
<span class="br0">&#123;</span><br />
self.window <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIWindow alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UIScreen mainScreen<span class="br0">&#93;</span> bounds<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
<span class="co2">// Override point for customization after application launch.</span><br />
self.mainViewController <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>MainViewController alloc<span class="br0">&#93;</span> initWithNibName<span class="sy0">:</span><span class="kw2">nil</span><br />
bundle<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
self.window.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor whiteColor<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.window addSubview<span class="sy0">:</span>self.mainViewController.view<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.window makeKeyAndVisible<span class="br0">&#93;</span>;<br />
<span class="kw1">return</span> <span class="kw2">YES</span>;<br />
<span class="br0">&#125;</span>.<br />
..</div>
</div>
<p>(We&#8217;re not showing the entire file, only the portion that requires changes to be made.)</p>
<p>First, we synthesize the property mainViewController. Following Apple&#8217;s recommendation, we<br />
synthesize this property with a name different from that given to it earlier, this makes it impossible to<br />
accidentally use it as an ivar: we must access it using its getter and setter methods.</p>
<p>Next we instantiate mainViewController by first allocating space on the heap for an object of class<br />
MainViewController, then calling initWithNibName: bundle: to initialize the object. In this case, we&#8217;ve<br />
already wired up the view controller, view, and File&#8217;s Owner in Interface Builder: a value of nil for the<br />
nib name will take the values already provided. A value of nil for the bundle parameter signals the<br />
system to take the current application bundle.</p>
<p>Finally, we add the mainViewController&#8217;s view as a subview of the main application window. When<br />
this window is made visible, the subview will be displayed on top of it.</p>
<p>Run the application to verify that the view is shown. At this point, the application is ready for<br />
development to proceed along traditional lines.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/RunningApp.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/RunningApp.png" alt="" title="RunningApp" width="577" height="775" class="aligncenter size-full wp-image-3496" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/using-the-empty-template-in-ipad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>StringConvert in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-apps/stringconvert-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-apps/stringconvert-in-iphone/#comments</comments>
		<pubDate>Mon, 07 May 2012 09:00:40 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Apps]]></category>
		<category><![CDATA[iPhone Programming Tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3483</guid>
		<description><![CDATA[In this application we will see how to string convert in uppercase in iPhone. So let see how it will
worked.
Step 1: Open the Xcode, Create a new project using Single View Application. Give the application
“StringConvert”.
Step 2: Need to add new viewController class in the project. Select project -> New file ->
UIViewController subclass -> next -> [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to string convert in uppercase in iPhone. So let see how it will<br />
worked.</p>
<p>Step 1: Open the Xcode, Create a new project using Single View Application. Give the application<br />
“StringConvert”.</p>
<p>Step 2: Need to add new viewController class in the project. Select project -> New file -><br />
UIViewController subclass -> next -> Give the application name “StringConvertView”.</p>
<p>Step 3: Now open the AppDelegate.h file and make the following changes:</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">@class</span> StringConvertView;<br />
<span class="kw1">@interface</span> AppDelegate <span class="sy0">:</span> UIResponder &lt;UIApplicationDelegate&gt;<br />
<span class="br0">&#123;</span><br />
StringConvertView <span class="sy0">*</span>stringConvertView;<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 StringConvertView <span class="sy0">*</span>stringConvertView;</div>
</div>
<p>Step 4: In the AppDelegate.m file make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;AppDelegate.h&quot;</span><br />
<span class="co1">#import &quot;StringConvertView.h&quot;</span><br />
<span class="kw1">@implementation</span> AppDelegate<br />
<span class="kw1">@synthesize</span> window <span class="sy0">=</span> _window;<br />
<span class="kw1">@synthesize</span> stringConvertView;<br />
<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><br />
<span class="sy0">*</span><span class="br0">&#41;</span>launchOptions<br />
<span class="br0">&#123;</span><br />
self.window <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIWindow alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UIScreen mainScreen<span class="br0">&#93;</span> bounds<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
<span class="co2">// Override point for customization after application launch.</span><br />
self.window.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor whiteColor<span class="br0">&#93;</span>;<br />
stringConvertView <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>StringConvertView alloc<span class="br0">&#93;</span><br />
initWithNibName<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;StringConvertView&quot;</span><br />
bundle<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>_window addSubview<span class="sy0">:</span>stringConvertView.view<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.window makeKeyAndVisible<span class="br0">&#93;</span>;<br />
<span class="kw1">return</span> <span class="kw2">YES</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p>Step 4: Now open the “StringConvertView.h” file and make the following changes:</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> StringConvertView <span class="sy0">:</span> UIViewController<br />
<span class="br0">&#123;</span><br />
IBOutlet UIButton <span class="sy0">*</span>button;<br />
IBOutlet UILabel<span class="sy0">*</span>resultText;<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 UIButton <span class="sy0">*</span>button;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UILabel<span class="sy0">*</span>resultText;<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> uppercaseString<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender;<br />
<span class="kw1">@end</span></div>
</div>
<p>Step 5: Double click the StringConvertView.xib file and open it to the Interface Builder. First drag<br />
the UIButton and UILabel from the library and place it to the view window. Select the button from<br />
the view window and bring up connection inspector and connect touch up inside to the File&#8217;s Owner<br />
icon and select “uppercaseString:” method and connect the File&#8217;s owner icon to the label and select<br />
“resultText”. Now save the .xib file, close it and go back to the Xcode.</p>
<p>Step 6: In the StringConvertView.m file make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;StringConvertView.h&quot;</span><br />
<span class="kw1">@implementation</span> StringConvertView<br />
<span class="kw1">@synthesize</span> button,resultText;<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> uppercaseString<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender<br />
<span class="br0">&#123;</span><br />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>string1 <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;welcome to iPhone&quot;</span>;<br />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>upperString <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/NSString_Class/"><span class="kw5">NSString</span></a> alloc<span class="br0">&#93;</span> initWithFormat<span class="sy0">:</span>string1<span class="br0">&#93;</span>;<br />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a><span class="sy0">*</span> changeString <span class="sy0">=</span> <span class="br0">&#91;</span>upperString uppercaseString<span class="br0">&#93;</span>;<br />
resultText.text <span class="sy0">=</span> changeString ;<br />
NSLog<span class="br0">&#40;</span>changeString<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>initWithNibName<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>nibNameOrNil bundle<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span class="kw5">NSBundle</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>nibBundleOrNil<br />
<span class="br0">&#123;</span><br />
self <span class="sy0">=</span> <span class="br0">&#91;</span>super initWithNibName<span class="sy0">:</span>nibNameOrNil bundle<span class="sy0">:</span>nibBundleOrNil<span class="br0">&#93;</span>;<br />
<span class="kw1">if</span> <span class="br0">&#40;</span>self<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
<span class="co2">// Custom initialization</span><br />
<span class="br0">&#125;</span><br />
<span class="kw1">return</span> self;<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>didReceiveMemoryWarning<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Releases the view if it doesn&#8217;t have a superview.</span><br />
<span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</span>;<br />
<span class="co2">// Release any cached data, images, etc that aren&#8217;t in use.</span><br />
<span class="br0">&#125;</span><br />
<span class="co1">#pragma mark &#8211; View lifecycle</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
<span class="co2">// Do any additional setup after loading the view from its nib.</span><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>viewDidUnload<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super viewDidUnload<span class="br0">&#93;</span>;<br />
<span class="co2">// Release any retained subviews of the main view.</span><br />
<span class="co2">// e.g. self.myOutlet = nil;</span><br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>shouldAutorotateToInterfaceOrientation<span class="sy0">:</span><span class="br0">&#40;</span>UIInterfaceOrientation<span class="br0">&#41;</span>interfaceOrientation<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Return YES for supported orientations</span><br />
<span class="kw1">return</span> <span class="br0">&#40;</span>interfaceOrientation <span class="sy0">==</span> UIInterfaceOrientationPortrait<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p>Step 7: Now compile and run the application on the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/StringConvert.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/StringConvert.jpg" alt="" title="StringConvert" width="347" height="622" class="alignnone size-full wp-image-3482" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-apps/stringconvert-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display Current Date and Time in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-apps/display-current-date-and-time-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-apps/display-current-date-and-time-in-iphone/#comments</comments>
		<pubDate>Thu, 03 May 2012 09:19:17 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Apps]]></category>
		<category><![CDATA[iPhone Game Programming]]></category>
		<category><![CDATA[iPhone Programming Tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3473</guid>
		<description><![CDATA[In this application we will see how to display current date and time in iPhone. So let see how it will
worked.
Step 1: Open the Xcode, Create a new project using Single View Application. Give the application
“CurrentDateTime”.
Step 2: Need to add new viewController class in the project. Select project -> New file ->
UIViewController subclass -> next [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to display current date and time in iPhone. So let see how it will<br />
worked.</p>
<p>Step 1: Open the Xcode, Create a new project using Single View Application. Give the application<br />
“CurrentDateTime”.</p>
<p>Step 2: Need to add new viewController class in the project. Select project -> New file -><br />
UIViewController subclass -> next -> Give the application name “CurrentDateTimeView”.</p>
<p>Step 3: Now open the AppDelegate.h file and make the following changes:</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">@class</span> CurrentDateTimeView;<br />
<span class="kw1">@interface</span> AppDelegate <span class="sy0">:</span> UIResponder &lt;UIApplicationDelegate&gt;<br />
<span class="br0">&#123;</span><br />
CurrentDateTimeView <span class="sy0">*</span>currentDateTimeView;<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 CurrentDateTimeView <span class="sy0">*</span>currentDateTimeView;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>strong, nonatomic<span class="br0">&#41;</span> UIWindow <span class="sy0">*</span>window;<br />
<span class="kw1">@end</span></div>
</div>
<p>Step 4: In the AppDelegate.m file make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;AppDelegate.h&quot;</span><br />
<span class="co1">#import &quot;CurrentDateTimeView.h&quot;</span><br />
<span class="kw1">@implementation</span> AppDelegate<br />
<span class="kw1">@synthesize</span> window <span class="sy0">=</span> _window,currentDateTimeView;<br />
<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><br />
<span class="sy0">*</span><span class="br0">&#41;</span>launchOptions<br />
<span class="br0">&#123;</span><br />
self.window <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIWindow alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UIScreen mainScreen<span class="br0">&#93;</span> bounds<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
<span class="co2">// Override point for customization after application launch.</span><br />
self.window.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor whiteColor<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.window makeKeyAndVisible<span class="br0">&#93;</span>;<br />
currentDateTimeView <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>CurrentDateTimeView alloc<span class="br0">&#93;</span><br />
initWithNibName<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;CurrentDateTimeView&quot;</span><br />
bundle<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>_window addSubview<span class="sy0">:</span>currentDateTimeView.view<span class="br0">&#93;</span>;<br />
<span class="kw1">return</span> <span class="kw2">YES</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p>Step 5: Now open the “CurrentDateTimeView.h” file and make the following changes:</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> CurrentDateTimeView <span class="sy0">:</span> UIViewController<br />
<span class="br0">&#123;</span><br />
IBOutlet UIButton <span class="sy0">*</span>button;<br />
<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="kw4">string</span>;<br />
IBOutlet UILabel <span class="sy0">*</span>dateLabel;<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 UIButton <span class="sy0">*</span>button;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UILabel <span class="sy0">*</span>dateLabel;<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/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span><span class="kw4">string</span>;<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>currentdate<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender;<br />
<span class="kw1">@end</span></div>
</div>
<p>Step 6: Double click the CurrentDateTimeView.xib file and open it to the Interface Builder. First<br />
drag the UIButton and UILabel from the library and place it to the view window. Select the button<br />
from the view window and bring up connection inspector and connect touch up inside to the File&#8217;s<br />
Owner icon and select “currentdate:” method and connect the File&#8217;s owner icon to the label and<br />
select “dateLabel”. Now save the .xib file, close it and go back to the Xcode.</p>
<p>Step 7: In the CurrentDateTimeView.m file make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;CurrentDateTimeView.h&quot;</span><br />
<span class="kw1">@implementation</span> CurrentDateTimeView<br />
<span class="kw1">@synthesize</span> button, <span class="kw4">string</span>, dateLabel;<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>currentdate<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender<br />
<span class="br0">&#123;</span><br />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span class="kw5">NSDate</span></a><span class="sy0">*</span> date <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 />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDateFormatter_Class/"><span class="kw5">NSDateFormatter</span></a><span class="sy0">*</span> formatter <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/NSDateFormatter_Class/"><span class="kw5">NSDateFormatter</span></a> alloc<span class="br0">&#93;</span> init<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>formatter setDateFormat<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;yyyy-MM-dd HH:MM:SS&quot;</span><span class="br0">&#93;</span>;<br />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a><span class="sy0">*</span> str <span class="sy0">=</span> <span class="br0">&#91;</span>formatter stringFromDate<span class="sy0">:</span>date<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>dateLabel setText<span class="sy0">:</span>str<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>initWithNibName<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>nibNameOrNil bundle<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span class="kw5">NSBundle</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>nibBundleOrNil<br />
<span class="br0">&#123;</span><br />
self <span class="sy0">=</span> <span class="br0">&#91;</span>super initWithNibName<span class="sy0">:</span>nibNameOrNil bundle<span class="sy0">:</span>nibBundleOrNil<span class="br0">&#93;</span>;<br />
<span class="kw1">if</span> <span class="br0">&#40;</span>self<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
<span class="co2">// Custom initialization</span><br />
<span class="br0">&#125;</span><br />
<span class="kw1">return</span> self;<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>didReceiveMemoryWarning<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Releases the view if it doesn&#8217;t have a superview.</span><br />
<span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</span>;<br />
<span class="co2">// Release any cached data, images, etc that aren&#8217;t in use.</span><br />
<span class="br0">&#125;</span><br />
<span class="co1">#pragma mark &#8211; View lifecycle</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
<span class="co2">// Do any additional setup after loading the view from its nib.</span><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>viewDidUnload<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super viewDidUnload<span class="br0">&#93;</span>;<br />
<span class="co2">// Release any retained subviews of the main view.</span><br />
<span class="co2">// e.g. self.myOutlet = nil;</span><br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>shouldAutorotateToInterfaceOrientation<span class="sy0">:</span><span class="br0">&#40;</span>UIInterfaceOrientation<span class="br0">&#41;</span>interfaceOrientation<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Return YES for supported orientations</span><br />
<span class="kw1">return</span> <span class="br0">&#40;</span>interfaceOrientation <span class="sy0">==</span> UIInterfaceOrientationPortrait<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p>Step 8: Now compile and run the application on the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/DateTime.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/DateTime.jpg" alt="" title="Date&amp;Time" width="350" height="597" class="alignnone size-full wp-image-3478" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-apps/display-current-date-and-time-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Text Field and Text View Controls in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-apps/using-text-field-and-text-view-controls-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-apps/using-text-field-and-text-view-controls-in-iphone/#comments</comments>
		<pubDate>Wed, 02 May 2012 08:26:55 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Apps]]></category>
		<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[iPhone programming]]></category>
		<category><![CDATA[Text View Controls in iPhone]]></category>
		<category><![CDATA[Using Text Field in iPhone]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3450</guid>
		<description><![CDATA[One common problem that arises when using UITextField and UITextView controls in iPhone (or iPad)
programming is that of dismissing the keyboard when text entry is complete. In this blog, we&#8217;ll show
you how this is done. 
Start Xcode, and choose “Create a new Xcode project.” Choose the Single View Application template,
and click Next. Name the project [...]]]></description>
			<content:encoded><![CDATA[<p>One common problem that arises when using UITextField and UITextView controls in iPhone (or iPad)<br />
programming is that of dismissing the keyboard when text entry is complete. In this blog, we&#8217;ll show<br />
you how this is done. </p>
<p>Start Xcode, and choose “Create a new Xcode project.” Choose the Single View Application template,<br />
and click Next. Name the project “TextControls” and choose options as shown below: </p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/ProjectOptions.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/ProjectOptions-300x202.png" alt="" title="ProjectOptions" width="500" height="350" class="alignnone size-medium wp-image-3458" /></a></p>
<p>Click Next, choose a location to save the app, then click Create. Select the MainStoryboard.storyboard<br />
file in the Project Navigator. If you wish, adjust the color of the view by changing the background color<br />
in the Attribute Inspector. </p>
<p>Drag a a Text Field and a Text View to the view as shown on the following page. Delete the text in the<br />
Text View control. The screen shot shows this text selected prior to deleting it. </p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/SelectingText.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/SelectingText-300x162.png" alt="" title="SelectingText" width="500" height="312" class="alignnone size-medium wp-image-3460" /></a></p>
<p>Change the value of the Return Key attribute to Done in the Attribute inspector for the Text Field, as<br />
shown below: </p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/SetReturnKey.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/SetReturnKey-300x121.png" alt="" title="SetReturnKey" width="450" height="230" class="alignnone size-medium wp-image-3461" /></a></p>
<p>Text Field controls are able to send an Event called “Did End On Exit” that is fired when the Done key<br />
is pressed on the keyboard. Text Views do not have this event, we must make some other provision for<br />
dismissing the keyboard. We&#8217;ll deal with the Text Field now, and come back to deal with the Text View<br />
in just a bit. </p>
<p>The next task is to write an action method to respond to the Text Field&#8217;s Did End On Exit method.<br />
Select the file ViewController.h in the Project Navigator, and make the bolded changes in the following<br />
listing: </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> ViewController <span class="sy0">:</span> UIViewController </p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>dismissKeyboard<span class="sy0">:</span><span class="br0">&#40;</span>UITextField <span class="sy0">*</span><span class="br0">&#41;</span>sender; </p>
<p><span class="kw1">@end</span></div>
</div>
<p>Now, open the ViewController.m file, and add the method definition to it: </p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;ViewController.h&quot; </span></p>
<p><span class="kw1">@interface</span> ViewController <span class="br0">&#40;</span><span class="br0">&#41;</span> <br />
<span class="kw1">@end</span> <br />
<span class="kw1">@implementation</span> ViewController </p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>dismissKeyboard<span class="sy0">:</span><span class="br0">&#40;</span>UITextField <span class="sy0">*</span><span class="br0">&#41;</span>sender <br />
<span class="br0">&#123;</span> <br />
<span class="br0">&#91;</span>sender resignFirstResponder<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>viewDidLoad <br />
<span class="br0">&#123;</span> <br />
<span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>; </p>
<p><span class="co2">// Do any additional setup after loading the view, typically from a nib. </span></p>
<p><span class="br0">&#125;</span> <br />
…</div>
</div>
<p>Return to the MainStoryboard.storyboard file, and right click the View Controller object. Click and<br />
drag from the circle to the right of the dismissKeyboard method to the TextField. When the popup<br />
comes up, select Did End On Exit from the list of available events. </p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/WireUpMethod.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/WireUpMethod-300x108.png" alt="" title="WireUpMethod" width="450" height="160<a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/ProjectOptions.png"></a></p>
<p>In the dismissKeyboard method, we are calling a method “resignFirstResponder” on the UITextField.<br />
This method tells the text field to stop being the first responder for events sent to the window. When the<br />
text field gives up its first responder status, its interface (the keyboard) is released and goes away. </p>
<p>Let&#8217;s run the app. In this test, since we haven&#8217;t done anything with the UITextView as yet, we will only<br />
interact with the text field control. Click on the text field. The keyboard will display: </p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/DemoTextField.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/DemoTextField-153x300.png" alt="" title="DemoTextField" width="153" height="300" class="alignleft size-medium wp-image-3455" /></a>When we click on the text field, we give it focus, and make it the first responder of the view it is in. As soon as a text<br />
control gains first responder status, it displays the keyboard for text entry. </p>
<p>At this point, the responder chain looks something like<br />
this: </p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/textcontrols11.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/textcontrols11-216x300.png" alt="" title="textcontrols11" width="216" height="300" class="alignnone size-medium wp-image-3463" /></a></p>
<p>Events “bubble up” the responder chain to be handled by the first responder in the chain that has an<br />
event handler for the event. In the case of the text field, it can (at this point) handle two events: the tap<br />
of a key on the keyboard (which is built-in) and the dismissKeyboard event (which we defined and<br />
wired up in Interface builder). Verify that the text field is handling keyboard taps by entering some text<br />
via the software keyboard. As you enter text, it will appear in the text field control. When you are<br />
finished, tap the “Done” button on the software keyboard. This will send the Did End On Exit event to<br />
the ViewController, which will handle the event using the dismissKeyboard method. </p>
<p>Now, let&#8217;s stop the running app, and learn how to handle the text view control. </p>
<p>Since UITextView is unable to send the Did End On Exit event, we must dismiss its keyboard a<br />
different way. The usual method is to use a button. But there are two ways to set the button up,<br />
depending on what we want the user experience to be. </p>
<p>If we want to indicate to the user that the app will do something with the text in the UITextView (such<br />
as saving it or sending it to a web service of some sort), we should put a visible button on the view, and<br />
wire it up to an action method that resigns the first responder on the text view control. This is the<br />
approach we&#8217;ll take now. </p>
<p>In ViewController.h, add the bolded lines: </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> ViewController <span class="sy0">:</span> UIViewController </p>
<p><span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, strong<span class="br0">&#41;</span> IBOutlet UITextView <span class="sy0">*</span>textView; </p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>dismissKeyboard<span class="sy0">:</span><span class="br0">&#40;</span>UITextField <span class="sy0">*</span><span class="br0">&#41;</span>sender; </p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>saveButtonClicked<span class="sy0">:</span><span class="br0">&#40;</span>UIButton <span class="sy0">*</span><span class="br0">&#41;</span>sender; </p>
<p><span class="kw1">@end</span></div>
</div>
<p>Synthesize the textView property and write the method definition in ViewController.m: </p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;ViewController.h&quot; </span></p>
<p><span class="kw1">@interface</span> ViewController <span class="br0">&#40;</span><span class="br0">&#41;</span> <br />
<span class="kw1">@end</span> <br />
<span class="kw1">@implementation</span> ViewController </p>
<p><span class="kw1">@synthesize</span> textView; </p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>dismissKeyboard<span class="sy0">:</span><span class="br0">&#40;</span>UITextField <span class="sy0">*</span><span class="br0">&#41;</span>sender <br />
<span class="br0">&#123;</span> <br />
<span class="br0">&#91;</span>sender resignFirstResponder<span class="br0">&#93;</span>; <br />
<span class="br0">&#125;</span> </p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>saveButtonClicked<span class="sy0">:</span><span class="br0">&#40;</span>UIButton <span class="sy0">*</span><span class="br0">&#41;</span>sender <br />
<span class="br0">&#123;</span> </p>
<p><span class="co2">// save the text in the text view here&#8230;</span><br />
<span class="co2">// then dismiss the keyboard:</span></p>
<p><span class="br0">&#91;</span>self.textView resignFirstResponder<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>viewDidLoad <br />
…</div>
</div>
<p>We&#8217;re not showing how to actually save the text here. As far as dismissing the keyboard, the approach<br />
is exactly the same: we&#8217;re telling the text view control to resign its first responder status. This is why<br />
we need the property defined on the UITextView. </p>
<p>Open up the MainStoryboard.storyboard file, drag a button to the view, and give it the title “Save” as<br />
shown: </p>
<p>Right click the new button, and drag from<a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/AddingSaveButton.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/AddingSaveButton-300x223.png" alt="" title="AddingSaveButton" width="300" height="223" class="alignright size-medium wp-image-3451" /></a> the circle to the right of the Touch Up Inside event to the View Controller<br />
object. The saveButtonClicked action will be shown; click it to wire up the event with the method that will handle it. </p>
<p>Now, right click the View Controller object, and drag from the circle to the right of the textView outlet to the text<br />
view object on the view. This will wire the textView property to the actual UITextView object in the view. </p>
<p>Now run the app again and test both the UITextField and UITextView to make sure that they can both dismiss the<br />
keyboard. Clicking the Done key while editing in the text field will dismiss the keyboard as before. To dismiss the keyboard while editing in the text view, simply click the “Save” button. </p>
<p>Another way to use a button to dismiss the keyboard from a text view is often seen. In this method,<br />
touching anywhere on the screen outside of the text controls or keyboard will dismiss the view. This<br />
method involves a trick – we&#8217;re going to change the type of the Save button, expand it to fill the view,<br />
and send it to the back of the control stack. Ready? Let&#8217;s do it! </p>
<p>First, using the drag handles of the save button, expand it so that it fills the entire view. After this step,<br />
the interface will look like this: </p>
<p>The second step is to send the button to the back of the list of controls on the view. Just grab the button<br />
in the View Controller Scene panel, and move it up to the top of<a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/SaveButtonShown.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/SaveButtonShown-201x300.png" alt="" title="SaveButtonShown" width="201" height="300" class="alignright size-medium wp-image-3459" /></a> the list of controls in the view: </p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/MovingButton.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/MovingButton.png" alt="" title="MovingButton" width="193" height="137" class="alignnone size-full wp-image-3457" /></a></p>
<p>Since controls are painted on the view in the order they are shown in this list, putting the button on top of the list will send it behind all other controls in the window. </p>
<p>The third step is to delete the title from the button. This can be done either by double – clicking the title on the button and deleting it, or by deleting the title directly in the Attributes inspector panel while the button is selected. Do this now. </p>
<p>The last step is to change the type of the button in the Attributes inspector panel to “Custom” as shown<br />
here: </p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/ButtonTypeCustom.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/ButtonTypeCustom.png" alt="" title="ButtonTypeCustom" width="255" height="165" class="alignnone size-full wp-image-3454" /></a></p>
<p>After this change is made, the button will change to a transparent color, so the underlying view color is<br />
displayed. </p>
<p>Run the program again. This time, touching anywhere in the background will dismiss the keyboard<br />
from the UITextView control.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/textcontrols12.png"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/05/textcontrols12-300x236.png" alt="" title="textcontrols12" width="300" height="236" class="alignnone size-medium wp-image-3464" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-apps/using-text-field-and-text-view-controls-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a Button as a Toggle</title>
		<link>http://www.edumobile.org/iphone/iphone-apps/using-a-button-as-a-toggle/</link>
		<comments>http://www.edumobile.org/iphone/iphone-apps/using-a-button-as-a-toggle/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 12:01:58 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Apps]]></category>
		<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[button as a toggle]]></category>
		<category><![CDATA[iphone development]]></category>
		<category><![CDATA[iphone tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3437</guid>
		<description><![CDATA[In this example, we will see how to make a UIButton control behave as a two – state toggle switch.
Even though the iOS control palette contains a YES / NO switch, sometimes it&#8217;s nice to have a choice
of controls that is capable of performing the same function. Let&#8217;s see how it works.
Start up Xcode and [...]]]></description>
			<content:encoded><![CDATA[<p>In this example, we will see how to make a UIButton control behave as a two – state toggle switch.<br />
Even though the iOS control palette contains a YES / NO switch, sometimes it&#8217;s nice to have a choice<br />
of controls that is capable of performing the same function. Let&#8217;s see how it works.</p>
<p>Start up Xcode and select “Create a New Xcode Project.” Choose the Single View Application template<br />
and click Next. Name the project ToggleButton, and make the project choices as shown below. Note<br />
that in this application we are not using a storyboard, but this makes no difference.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/ProjectOptions.png"><img class="alignnone size-full wp-image-3442" title="ProjectOptions" src="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/ProjectOptions.png" alt="" width="530" height="320" /></a></p>
<p>Choose a location to save the file, and click Create.</p>
<p>Once the files are created, in the Project Navigator, select the ViewController.xib file. Select the view<br />
object in the Interface Builder, and give it a nice background color, as shown on the next page:</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/SettingColor.png"><img class="alignnone size-full wp-image-3444" title="SettingColor" src="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/SettingColor.png" alt="" width="515" height="420" /></a><br />
Drag a Round Rect Button from the Object Library to the view. Set the Title attribute of the button to<br />
be “Color On” as shown:</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/SettingButtonTitle.png"><img class="alignnone size-full wp-image-3443" title="SettingButtonTitle" src="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/SettingButtonTitle.png" alt="" width="438" height="110" /></a><br />
Now we&#8217;re going to provide an action method in the View Controller to respond to the user&#8217;s touching<br />
the button. In the Project Navigator, select the ViewController.h file.<br />
Make the changes as shown in <strong>bold:</strong></p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import</span><br />
<span class="kw1">@interface</span> ViewController <span class="sy0">:</span> UIViewController<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>strong, nonatomic<span class="br0">&#41;</span> UIColor <span class="sy0">*</span>activeViewColor;<br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>buttonTouched<span class="sy0">:</span><span class="br0">&#40;</span>UIButton <span class="sy0">*</span><span class="br0">&#41;</span>sender;<br />
<span class="kw1">@end</span></div>
</div>
<p>Now, open up ViewController.m. First, we want to @synthesize the activeViewColor property. Second,<br />
we need to implement the buttonTouched: method. Third, we must capture the starting color of the<br />
view in the viewDidLoad method. Make the bolded changes to ViewController.m, as shown here:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;ViewController.h&quot;</span><br />
<span class="kw1">@interface</span> ViewController <span class="br0">&#40;</span><span class="br0">&#41;</span><br />
<span class="kw1">@end</span><br />
<span class="kw1">@implementation</span> ViewController<br />
<span class="kw1">@synthesize</span> activeViewColor;<br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>buttonTouched<span class="sy0">:</span><span class="br0">&#40;</span>UIButton <span class="sy0">*</span><span class="br0">&#41;</span>sender<br />
<span class="br0">&#123;</span><br />
<span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>sender.titleLabel.text isEqualToString<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Color On&quot;</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>sender setTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Color Off&quot;</span> forState<span class="sy0">:</span>UIControlStateNormal<span class="br0">&#93;</span>;<br />
self.view.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor blackColor<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>sender setTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Color On&quot;</span> forState<span class="sy0">:</span>UIControlStateNormal<span class="br0">&#93;</span>;<br />
self.view.backgroundColor <span class="sy0">=</span> self.activeViewColor;<br />
<span class="br0">&#125;</span><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>viewDidLoad<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
<span class="co2">// Do any additional setup after loading the view, typically from a nib.</span><br />
self.activeViewColor <span class="sy0">=</span> self.view.backgroundColor;<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>viewDidUnload<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super viewDidUnload<span class="br0">&#93;</span>;<br />
<span class="co2">// Release any retained subviews of the main view.</span><br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>shouldAutorotateToInterfaceOrientation<span class="sy0">:</span><span class="br0">&#40;</span>UIInterfaceOrientation<span class="br0">&#41;</span>interfaceOrientation<br />
<span class="br0">&#123;</span><br />
<span class="kw1">return</span> <span class="br0">&#40;</span>interfaceOrientation <span class="sy0">!=</span> UIInterfaceOrientationPortraitUpsideDown<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p>The last step is to wire up the action method to the button. Return to the ViewController.xib file, and<br />
right-click the File&#8217;s Owner object. Drag from the circle to the right of the buttonTouched: method to<br />
the button in the view. In the pop-up window, select “Touch Up Inside” to denote that we want to action<br />
to execute when the user raises their finger while still inside the bounds of the button. Build and run the<br />
application, and test the action of your new toggle button!</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/DemoStateOn.png"><img class="alignleft size-full wp-image-3441" title="DemoStateOn" src="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/DemoStateOn.png" alt="" width="208" height="408" /></a><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/DemoStateOff.png"><img class="alignright size-full wp-image-3440" title="DemoStateOff" src="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/DemoStateOff.png" alt="" width="208" height="408" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-apps/using-a-button-as-a-toggle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>StoryBoard Example in iPhone</title>
		<link>http://www.edumobile.org/iphone/miscellaneous/storyboard-example-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/miscellaneous/storyboard-example-in-iphone/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 11:07:41 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3428</guid>
		<description><![CDATA[In this application we will see how to StoryBoard works in iPhone iOS 5.0. So let see how it will
worked.
Step 1: Open the Xcode, Create a new project using Single View Application. Give the application
“StoryBoardExample” and select the “Use Storyboard”.
Step 2: Select the MainStoryboard.storyboard, first drag the ViewController from the library and
place it to the [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to StoryBoard works in iPhone iOS 5.0. So let see how it will<br />
worked.</p>
<p>Step 1: Open the Xcode, Create a new project using Single View Application. Give the application<br />
“StoryBoardExample” and select the “Use Storyboard”.</p>
<p>Step 2: Select the MainStoryboard.storyboard, first drag the ViewController from the library and<br />
place it to the under View Controller Scene (See the figure 1)</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/1.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/1-300x145.jpg" alt="" title="1" width="300" height="145" class="alignnone size-medium wp-image-3429" /></a></p>
<p>Step 3: Drag the UIButton from the library and place it to the view window. Select the button and<br />
bring up Attribute Inspector and give the Title “Click Here”. Now Select the button and “control +<br />
drag” from the button to the next view controller and select the “Model” (See the figure 2).</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/21.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/21-300x212.jpg" alt="" title="2" width="300" height="212" class="alignnone size-medium wp-image-3433" /></a></p>
<p>Step 4: Now select the second ViewController view and bring up Attribute Inspector select the<br />
background color “Black”. Drag the label from the library and bring up Attribute Inspector and<br />
change the Text “Hello iPhone!!!”. (See the figure 3)</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/3.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/3-300x149.jpg" alt="" title="3" width="300" height="149" class="alignnone size-medium wp-image-3431" /></a></p>
<p>Step 5: Now compile and run the application on the simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/4.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/04/4-300x176.jpg" alt="" title="4" width="300" height="176" class="alignnone size-medium wp-image-3432" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/miscellaneous/storyboard-example-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Digital Signature Application in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-beginner-tutorials/digital-signature-application-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-beginner-tutorials/digital-signature-application-in-iphone/#comments</comments>
		<pubDate>Mon, 26 Mar 2012 02:19:32 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Beginner Tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3420</guid>
		<description><![CDATA[In this application we will see how to DigitalSignature draw in iPhone. So let see how it will worked.
Step 1: Open the Xcode, Create a new project using Empty Application . Give the application “DigitalSignature”.
Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to DigitalSignature draw in iPhone. So let see how it will worked.</p>
<p>Step 1: Open the Xcode, Create a new project using Empty Application . Give the application “DigitalSignature”.</p>
<p>Step 2: 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>Step 3: We need to create a ViewController class for this application. So select the project New file -> UIViewControllersubclass -> Next -> Give the class name DigitalSignatureView.</p>
<p>Step 4: Open the AppDelegate.h file and make the following changes:</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">@class</span> DigitalSignatureView;<br />
<span class="kw1">@interface</span> AppDelegate <span class="sy0">:</span> UIResponder &lt;UIApplicationDelegate&gt;<br />
<span class="br0">&#123;</span><br />
DigitalSignatureView <span class="sy0">*</span>digitalSignatureView;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>strong, nonatomic<span class="br0">&#41;</span> UIWindow <span class="sy0">*</span>window;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>strong, nonatomic<span class="br0">&#41;</span> DigitalSignatureView <span class="sy0">*</span>digitalSignatureView;<br />
<span class="kw1">@end</span></div>
</div>
<p>Step 5: Open the AppDelegate.m file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;AppDelegate.h&quot;</span><br />
<span class="co1">#import &quot;DigitalSignatureView.h&quot;</span><br />
<span class="kw1">@implementation</span> AppDelegate<br />
<span class="kw1">@synthesize</span> window <span class="sy0">=</span> _window,digitalSignatureView;<br />
<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><br />
<span class="sy0">*</span><span class="br0">&#41;</span>launchOptions<br />
<span class="br0">&#123;</span><br />
self.window <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIWindow alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UIScreen mainScreen<span class="br0">&#93;</span> bounds<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
<span class="co2">// Override point for customization after application launch.</span><br />
self.window.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor blackColor<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.window makeKeyAndVisible<span class="br0">&#93;</span>;<br />
digitalSignatureView <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>DigitalSignatureView alloc<span class="br0">&#93;</span><br />
initWithNibName<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;DigitalSignatureView&quot;</span><br />
bundle<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.window addSubview<span class="sy0">:</span>digitalSignatureView.view<span class="br0">&#93;</span>;<br />
<span class="kw1">return</span> <span class="kw2">YES</span>;<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>applicationWillResignActive<span class="sy0">:</span><span class="br0">&#40;</span>UIApplication <span class="sy0">*</span><span class="br0">&#41;</span>application<br />
<span class="br0">&#123;</span><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>applicationDidEnterBackground<span class="sy0">:</span><span class="br0">&#40;</span>UIApplication <span class="sy0">*</span><span class="br0">&#41;</span>application<br />
<span class="br0">&#123;</span><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>applicationWillEnterForeground<span class="sy0">:</span><span class="br0">&#40;</span>UIApplication <span class="sy0">*</span><span class="br0">&#41;</span>application<br />
<span class="br0">&#123;</span><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>applicationDidBecomeActive<span class="sy0">:</span><span class="br0">&#40;</span>UIApplication <span class="sy0">*</span><span class="br0">&#41;</span>application<br />
<span class="br0">&#123;</span><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>applicationWillTerminate<span class="sy0">:</span><span class="br0">&#40;</span>UIApplication <span class="sy0">*</span><span class="br0">&#41;</span>application<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p>Step 6: In the DigitalSignatureView.h file, make the following changes:</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> DigitalSignatureView <span class="sy0">:</span> UIViewController<br />
<span class="br0">&#123;</span><br />
CGPoint point;<br />
UIImageView <span class="sy0">*</span>image;<br />
<span class="kw4">BOOL</span> mouseSwiped;<br />
<span class="kw4">int</span> mouseMoved;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>strong, nonatomic<span class="br0">&#41;</span>IBOutlet UIImageView <span class="sy0">*</span>image;<br />
<span class="kw1">@end</span></div>
</div>
<p>Step 7: Double click the DigitalSignatureView.xib file and open it to the interface builder. Select the view from interface builder and bring up Attribute Inspector. Change the background color into black. Drag the imageView from the library and<br />
place it to the view. Connect File&#8217;s Owner icon to the View and select image. Now save the .xib file , close it and go back to the Xcode. </p>
<p>Step 8: Open the DigitalSignatureView.m file, make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;DigitalSignatureView.h&quot;</span><br />
<span class="kw1">@implementation</span> DigitalSignatureView<br />
<span class="kw1">@synthesize</span> image;<br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>initWithNibName<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>nibNameOrNil bundle<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span class="kw5">NSBundle</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>nibBundleOrNil<br />
<span class="br0">&#123;</span><br />
self <span class="sy0">=</span> <span class="br0">&#91;</span>super initWithNibName<span class="sy0">:</span>nibNameOrNil bundle<span class="sy0">:</span>nibBundleOrNil<span class="br0">&#93;</span>;<br />
<span class="kw1">if</span> <span class="br0">&#40;</span>self<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
<span class="co2">// Custom initialization</span><br />
<span class="br0">&#125;</span><br />
<span class="kw1">return</span> self;<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>didReceiveMemoryWarning<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Releases the view if it doesn&#8217;t have a superview.</span><br />
<span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</span>;<br />
<span class="co2">// Release any cached data, images, etc that aren&#8217;t in use.</span><br />
<span class="br0">&#125;</span><br />
<span class="co1">#pragma mark &#8211; View lifecycle</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad<br />
<span class="br0">&#123;</span><br />
mouseMoved <span class="sy0">=</span> <span class="nu0">0</span>;<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>touchesBegan<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 />
mouseSwiped <span class="sy0">=</span> <span class="kw2">NO</span>;<br />
UITouch <span class="sy0">*</span>touch <span class="sy0">=</span> <span class="br0">&#91;</span>touches anyObject<span class="br0">&#93;</span>;<br />
<span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>touch tapCount<span class="br0">&#93;</span> <span class="sy0">==</span> 2<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
image.image <span class="sy0">=</span> <span class="kw2">nil</span>;<br />
<span class="kw1">return</span>;<br />
<span class="br0">&#125;</span><br />
point <span class="sy0">=</span> <span class="br0">&#91;</span>touch locationInView<span class="sy0">:</span>self.view<span class="br0">&#93;</span>;<br />
point.y <span class="sy0">-=</span> <span class="nu0">20</span>;<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>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 <span class="br0">&#123;</span><br />
mouseSwiped <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
UITouch <span class="sy0">*</span>touch <span class="sy0">=</span> <span class="br0">&#91;</span>touches anyObject<span class="br0">&#93;</span>;<br />
CGPoint currentPoint <span class="sy0">=</span> <span class="br0">&#91;</span>touch locationInView<span class="sy0">:</span>self.view<span class="br0">&#93;</span>;<br />
currentPoint.y <span class="sy0">-=</span> <span class="nu0">20</span>;<br />
UIGraphicsBeginImageContext<span class="br0">&#40;</span>self.view.frame.size<span class="br0">&#41;</span>;<br />
<span class="br0">&#91;</span>image.image drawInRect<span class="sy0">:</span>CGRectMake<span class="br0">&#40;</span>0, 0, self.view.frame.size.width,<br />
self.view.frame.size.height<span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
CGContextSetLineCap<span class="br0">&#40;</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span>, kCGLineCapRound<span class="br0">&#41;</span>;<br />
CGContextSetLineWidth<span class="br0">&#40;</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span>, 5.0<span class="br0">&#41;</span>;<br />
CGContextSetRGBStrokeColor<span class="br0">&#40;</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span>, 1.0, 0.0, 0.0, 1.0<span class="br0">&#41;</span>;<br />
CGContextBeginPath<span class="br0">&#40;</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
CGContextMoveToPoint<span class="br0">&#40;</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span>, point.x, point.y<span class="br0">&#41;</span>;<br />
CGContextAddLineToPoint<span class="br0">&#40;</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span>, currentPoint.x, currentPoint.y<span class="br0">&#41;</span>;<br />
CGContextStrokePath<span class="br0">&#40;</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
image.image <span class="sy0">=</span> UIGraphicsGetImageFromCurrentImageContext<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
UIGraphicsEndImageContext<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
point <span class="sy0">=</span> currentPoint;<br />
mouseMoved<span class="sy0">++</span>;<br />
<span class="kw1">if</span> <span class="br0">&#40;</span>mouseMoved <span class="sy0">==</span> 10<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
mouseMoved <span class="sy0">=</span> <span class="nu0">0</span>;<br />
<span class="br0">&#125;</span><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>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 />
UITouch <span class="sy0">*</span>touch <span class="sy0">=</span> <span class="br0">&#91;</span>touches anyObject<span class="br0">&#93;</span>;<br />
<span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>touch tapCount<span class="br0">&#93;</span> <span class="sy0">==</span> 2<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
image.image <span class="sy0">=</span> <span class="kw2">nil</span>;<br />
<span class="kw1">return</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">if</span><span class="br0">&#40;</span><span class="sy0">!</span>mouseSwiped<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
UIGraphicsBeginImageContext<span class="br0">&#40;</span>self.view.frame.size<span class="br0">&#41;</span>;<br />
<span class="br0">&#91;</span>image.image drawInRect<span class="sy0">:</span>CGRectMake<span class="br0">&#40;</span>0, 0, self.view.frame.size.width,<br />
self.view.frame.size.height<span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
CGContextSetLineCap<span class="br0">&#40;</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span>, kCGLineCapRound<span class="br0">&#41;</span>;<br />
CGContextSetLineWidth<span class="br0">&#40;</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span>, 5.0<span class="br0">&#41;</span>;<br />
CGContextSetRGBStrokeColor<span class="br0">&#40;</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span>, 1.0, 0.0, 0.0, 1.0<span class="br0">&#41;</span>;<br />
CGContextMoveToPoint<span class="br0">&#40;</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span>, point.x, point.y<span class="br0">&#41;</span>;<br />
CGContextAddLineToPoint<span class="br0">&#40;</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span>, point.x, point.y<span class="br0">&#41;</span>;<br />
CGContextStrokePath<span class="br0">&#40;</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
CGContextFlush<span class="br0">&#40;</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
image.image <span class="sy0">=</span> UIGraphicsGetImageFromCurrentImageContext<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
UIGraphicsEndImageContext<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><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>viewDidUnload<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super viewDidUnload<span class="br0">&#93;</span>;<br />
<span class="co2">// Release any retained subviews of the main view.</span><br />
<span class="co2">// e.g. self.myOutlet = nil;</span><br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>shouldAutorotateToInterfaceOrientation<span class="sy0">:</span><span class="br0">&#40;</span>UIInterfaceOrientation<span class="br0">&#41;</span>interfaceOrientation<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Return YES for supported orientations</span><br />
<span class="kw1">return</span> <span class="br0">&#40;</span>interfaceOrientation <span class="sy0">==</span> UIInterfaceOrientationPortrait<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p>Step 9: Now Compile and run the application on the Simulator.<br />
<a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/02/11.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/02/11-157x300.jpg" alt="" title="1" width="157" height="300" class="alignnone size-medium wp-image-3422" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-beginner-tutorials/digital-signature-application-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SliderExample Application in iPhone</title>
		<link>http://www.edumobile.org/iphone/miscellaneous/sliderexample-application-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/miscellaneous/sliderexample-application-in-iphone/#comments</comments>
		<pubDate>Tue, 20 Mar 2012 05:14:46 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3414</guid>
		<description><![CDATA[In this application we will see how to Slider worked and change the value in iPhone. So let see how it will worked.
Step 1: Open the Xcode, Create a new project using View Base application. Give the application “SliderExample”.
Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to Slider worked and change the value in iPhone. So let see how it will worked.</p>
<p>Step 1: Open the Xcode, Create a new project using View Base application. Give the application “SliderExample”.</p>
<p>Step 2: 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>Step 3: Expand classes and notice Interface Builder created the ViewController class for you. Expand Resources and notice the template generated a separate nib, SliderExampleViewController.xib for the EmailSend application.</p>
<p>Step 4: Open the SliderExampleViewController.h file and make the following changes:</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> SliderExampleViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
IBOutlet UISlider <span class="sy0">*</span>sliderValue;<br />
IBOutlet UILabel <span class="sy0">*</span>sliderValueTxt;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> UILabel <span class="sy0">*</span>sliderValueTxt;<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>SliderValue<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender;</div>
</div>
<p>Step 6: Double click the SliderExampleViewController.xib file and open it to the interface Builder. Drag the slide and label from the library and place it to the View window. Now select the slide and bring up Connection Inspector and connect<br />
ValueChange to the File&#8217;s Owner icon and select SliderValue: method and connect File&#8217;s owner icon to label and select sliderValueTxt Now Save the .xib file, close it and go back to the Xcode.</p>
<p>Step 7: Open the SliderExampleViewController.m file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;SliderExampleViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> SliderExampleViewController<br />
<span class="kw1">@synthesize</span> sliderValueTxt;<br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>dealloc<br />
<span class="br0">&#123;</span><br />
<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>IBAction<span class="br0">&#41;</span>SliderValue<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender<br />
<span class="br0">&#123;</span><br />
sliderValueTxt .text<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/NSString_Class/"><span class="kw5">NSString</span></a> alloc<span class="br0">&#93;</span> initWithFormat<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;%d &quot;</span>, <span class="br0">&#40;</span><span class="kw4">int</span><span class="br0">&#41;</span>sliderValue.value<span class="br0">&#93;</span>;<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>didReceiveMemoryWarning<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Releases the view if it doesn&#8217;t have a superview.</span><br />
<span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</span>;<br />
<span class="co2">// Release any cached data, images, etc that aren&#8217;t in use.</span><br />
<span class="br0">&#125;</span><br />
<span class="co1">#pragma mark &#8211; View lifecycle</span><br />
<span class="coMULTI">/*<br />
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.<br />
- (void)viewDidLoad<br />
{<br />
[super viewDidLoad];<br />
}<br />
*/</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidUnload<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super viewDidUnload<span class="br0">&#93;</span>;<br />
<span class="co2">// Release any retained subviews of the main view.</span><br />
<span class="co2">// e.g. self.myOutlet = nil;</span><br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>shouldAutorotateToInterfaceOrientation<span class="sy0">:</span><span class="br0">&#40;</span>UIInterfaceOrientation<span class="br0">&#41;</span>interfaceOrientation<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Return YES for supported orientations</span><br />
<span class="kw1">return</span> <span class="br0">&#40;</span>interfaceOrientation <span class="sy0">==</span> UIInterfaceOrientationPortrait<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p>Step 8: Now Compile and run the application on the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/02/1.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/02/1-162x300.jpg" alt="" title="1" width="162" height="300" class="alignnone size-medium wp-image-3416" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/miscellaneous/sliderexample-application-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check Box Application in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-interface-builder/check-box-application-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-interface-builder/check-box-application-in-iphone/#comments</comments>
		<pubDate>Sat, 25 Feb 2012 06:07:36 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Interface Builder]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3401</guid>
		<description><![CDATA[In this application we will see how to CheckBox implement in iPhone. So let see how it will worked.
Step 1: Open the Xcode, Create a new project using View Base application. Give the application “CheckBox”.
Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to CheckBox implement in iPhone. So let see how it will worked.</p>
<p>Step 1: Open the Xcode, Create a new project using View Base application. Give the application “CheckBox”.</p>
<p>Step 2: 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>Step 3: Expand classes and notice Interface Builder created the ViewController class for you. Expand Resources and notice the template generated a separate nib, CheckBoxViewController.xib for the CheckBox application.</p>
<p>Step 4: Open the CheckBoxViewController.h file and make the following changes:</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> CheckboxViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
<span class="kw4">BOOL</span> boxSelected;<br />
IBOutlet UIButton <span class="sy0">*</span>checkbox;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>SelectButton<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender;<br />
<span class="kw1">@end</span></div>
</div>
<p>Step 6: Double click the CheckBoxViewController.xib file and open it to the interface Builder. Drag the round rect button from the library and place it to the View window. Now select the button and bring up Attribute inspector and select the image “checkbox.png” and bring up Connection Inspector and connect Touch Up Inside to the File&#8217;s Owner icon and select SelectButton: method. Now Save the .xib file, close it and go back to the Xcode.</p>
<p>Step 7: Open the CheckBoxViewController.m file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;CheckboxViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> CheckboxViewController<br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>SelectButton<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 />
<span class="kw1">if</span> <span class="br0">&#40;</span>boxSelected <span class="sy0">==</span> 0<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>checkbox setSelected<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
boxSelected <span class="sy0">=</span> <span class="nu0">1</span>;<br />
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>checkbox setSelected<span class="sy0">:</span><span class="kw2">NO</span><span class="br0">&#93;</span>;<br />
boxSelected <span class="sy0">=</span> <span class="nu0">0</span>;<br />
<span class="br0">&#125;</span><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>viewDidLoad <span class="br0">&#123;</span><br />
boxSelected <span class="sy0">==</span> <span class="nu0">0</span>;<br />
<span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<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>didReceiveMemoryWarning <span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</span>; <span class="co2">// Releases the view if it doesn&#8217;t have a superview</span><br />
<span class="co2">// Release anything that&#8217;s not essential, such as cached data</span><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>dealloc <span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super dealloc<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p>Step 8: Now Compile and run the application on the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/01/12.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/01/12-165x300.jpg" alt="" title="1" width="165" height="300" class="alignnone size-medium wp-image-3403" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-interface-builder/check-box-application-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Photos Application in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-apps/photos-application-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-apps/photos-application-in-iphone/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 09:41:24 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Apps]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3393</guid>
		<description><![CDATA[In this application we will see how to multiple photos select from the photo gallery and we can display, rotate and swipe this photo in the view. So let see how it will worked.
Step 1: Open the Xcode, Create a new project using View Base application. Give the application “PhotosApp”.
Step 2: Xcode automatically creates the [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to multiple photos select from the photo gallery and we can display, rotate and swipe this photo in the view. So let see how it will worked.</p>
<p>Step 1: Open the Xcode, Create a new project using View Base application. Give the application “PhotosApp”.</p>
<p>Step 2: 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>Step 3: Expand classes and notice Interface Builder created the ViewController class for you. Expand Resources and  notice the template generated a separate nib, PhotosAppViewController.xib for the ImageClick application.</p>
<p>Step 4: We need to add the framework MobileCoreServices.framework</p>
<p>Step 5: Open the PhotosAppViewController.h file and make the following changes:</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;MobileCoreServices/MobileCoreServices.h&gt;</span><br />
<span class="kw1">@interface</span> PhotosAppViewController <span class="sy0">:</span> UIViewController &lt;UINavigationControllerDelegate,<br />
UIImagePickerControllerDelegate, UIPopoverControllerDelegate, UIGestureRecognizerDelegate&gt;<br />
<span class="br0">&#123;</span><br />
CGFloat Scale;<br />
CGFloat XPosition;<br />
CGFloat YPosition;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>Photosadd<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender;<br />
<span class="kw1">@end</span></div>
</div>
<p>Step 6: Double click the PhotosAppViewController.xib file and open it to the interface Builder. Drag the Toolbar and Bar Button Item from the library and place it to the View window. Now select the button and bring up Connection Inspector and connect Touch Up Inside to the File&#8217;s Owner icon and select Photosadd: method and drag the label from library and place it to the view window and bring up Attribute Inspector change the text “Swipe Photos Here ” . Now Save the .xib file, close it and go back to the Xcode.</p>
<p>Step 7: Open the PhotosAppViewController.m file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;PhotosAppViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> PhotosAppViewController<br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>dealloc<br />
<span class="br0">&#123;</span><br />
<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><span class="kw4">void</span><span class="br0">&#41;</span>didReceiveMemoryWarning<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Releases the view if it doesn&#8217;t have a superview.</span><br />
<span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</span>;<br />
<span class="co2">// Release any cached data, images, etc that aren&#8217;t in use.</span><br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>Photosadd<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 />
UIImagePickerController <span class="sy0">*</span>controller <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIImagePickerController alloc<span class="br0">&#93;</span> init<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>controller setMediaTypes<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>kUTTypeImage<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>controller setDelegate<span class="sy0">:</span>self<span class="br0">&#93;</span>;<br />
UIPopoverController <span class="sy0">*</span>popover <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIPopoverController alloc<span class="br0">&#93;</span><br />
initWithContentViewController<span class="sy0">:</span>controller<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>popover setDelegate<span class="sy0">:</span>self<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>popover presentPopoverFromBarButtonItem<span class="sy0">:</span>sender<br />
permittedArrowDirections<span class="sy0">:</span>UIPopoverArrowDirectionUp animated<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<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>imagePickerController<span class="sy0">:</span><span class="br0">&#40;</span>UIImagePickerController <span class="sy0">*</span><span class="br0">&#41;</span>picker didFinishPickingMediaWithInfo<span class="sy0">:</span><br />
<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>info <span class="br0">&#123;</span><br />
UIImage <span class="sy0">*</span>image <span class="sy0">=</span> <span class="br0">&#91;</span>info objectForKey<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;UIImagePickerControllerOriginalImage&quot;</span><span class="br0">&#93;</span>;<br />
UIView <span class="sy0">*</span>holderView <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>CGRectMake<span class="br0">&#40;</span>0, 0, image.size.width,<br />
image.size.height<span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
UIImageView <span class="sy0">*</span>imageview <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIImageView alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span><span class="br0">&#91;</span>holderView frame<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>imageview setImage<span class="sy0">:</span>image<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>holderView addSubview<span class="sy0">:</span>imageview<span class="br0">&#93;</span>;<br />
UIPinchGestureRecognizer <span class="sy0">*</span>pinchRecognizer <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIPinchGestureRecognizer alloc<span class="br0">&#93;</span><br />
initWithTarget<span class="sy0">:</span>self action<span class="sy0">:</span><span class="kw1">@selector</span><span class="br0">&#40;</span>scale<span class="sy0">:</span><span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>pinchRecognizer setDelegate<span class="sy0">:</span>self<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>holderView addGestureRecognizer<span class="sy0">:</span>pinchRecognizer<span class="br0">&#93;</span>;<br />
UIRotationGestureRecognizer <span class="sy0">*</span>rotationRecognizer <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIRotationGestureRecognizer alloc<span class="br0">&#93;</span><br />
initWithTarget<span class="sy0">:</span>self action<span class="sy0">:</span><span class="kw1">@selector</span><span class="br0">&#40;</span>rotate<span class="sy0">:</span><span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>rotationRecognizer setDelegate<span class="sy0">:</span>self<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>holderView addGestureRecognizer<span class="sy0">:</span>rotationRecognizer<span class="br0">&#93;</span>;<br />
UIPanGestureRecognizer <span class="sy0">*</span>panRecognizer <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIPanGestureRecognizer alloc<span class="br0">&#93;</span><br />
initWithTarget<span class="sy0">:</span>self action<span class="sy0">:</span><span class="kw1">@selector</span><span class="br0">&#40;</span>move<span class="sy0">:</span><span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>panRecognizer setMinimumNumberOfTouches<span class="sy0">:</span>1<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>panRecognizer setMaximumNumberOfTouches<span class="sy0">:</span>1<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>panRecognizer setDelegate<span class="sy0">:</span>self<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>holderView addGestureRecognizer<span class="sy0">:</span>panRecognizer<span class="br0">&#93;</span>;<br />
UITapGestureRecognizer <span class="sy0">*</span>tapRecognizer <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UITapGestureRecognizer alloc<span class="br0">&#93;</span><br />
initWithTarget<span class="sy0">:</span>self action<span class="sy0">:</span><span class="kw1">@selector</span><span class="br0">&#40;</span>tapped<span class="sy0">:</span><span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>tapRecognizer setNumberOfTapsRequired<span class="sy0">:</span>1<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>tapRecognizer setDelegate<span class="sy0">:</span>self<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>holderView addGestureRecognizer<span class="sy0">:</span>tapRecognizer<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.view addSubview<span class="sy0">:</span>holderView<span class="br0">&#93;</span>;<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>scale<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 />
<span class="br0">&#91;</span>self.view bringSubviewToFront<span class="sy0">:</span><span class="br0">&#91;</span><span class="br0">&#40;</span>UIPinchGestureRecognizer<span class="sy0">*</span><span class="br0">&#41;</span>sender view<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
<span class="kw1">if</span><span class="br0">&#40;</span><span class="br0">&#91;</span><span class="br0">&#40;</span>UIPinchGestureRecognizer<span class="sy0">*</span><span class="br0">&#41;</span>sender state<span class="br0">&#93;</span> <span class="sy0">==</span> UIGestureRecognizerStateEnded<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
Scale <span class="sy0">=</span> <span class="nu0">1.0</span>;<br />
<span class="kw1">return</span>;<br />
<span class="br0">&#125;</span><br />
CGFloat scale <span class="sy0">=</span> 1.0 <span class="sy0">-</span> <span class="br0">&#40;</span>Scale <span class="sy0">-</span> <span class="br0">&#91;</span><span class="br0">&#40;</span>UIPinchGestureRecognizer<span class="sy0">*</span><span class="br0">&#41;</span>sender scale<span class="br0">&#93;</span><span class="br0">&#41;</span>;<br />
CGAffineTransform currentTransform <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#40;</span>UIPinchGestureRecognizer<span class="sy0">*</span><span class="br0">&#41;</span>sender<br />
view<span class="br0">&#93;</span>.transform;<br />
CGAffineTransform newTransform <span class="sy0">=</span> CGAffineTransformScale<span class="br0">&#40;</span>currentTransform, scale,<br />
scale<span class="br0">&#41;</span>;<br />
<span class="br0">&#91;</span><span class="br0">&#91;</span><span class="br0">&#40;</span>UIPinchGestureRecognizer<span class="sy0">*</span><span class="br0">&#41;</span>sender view<span class="br0">&#93;</span> setTransform<span class="sy0">:</span>newTransform<span class="br0">&#93;</span>;<br />
Scale <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#40;</span>UIPinchGestureRecognizer<span class="sy0">*</span><span class="br0">&#41;</span>sender scale<span class="br0">&#93;</span>;<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>move<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 />
<span class="br0">&#91;</span><span class="br0">&#91;</span><span class="br0">&#91;</span><span class="br0">&#40;</span>UITapGestureRecognizer<span class="sy0">*</span><span class="br0">&#41;</span>sender view<span class="br0">&#93;</span> layer<span class="br0">&#93;</span> removeAllAnimations<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.view bringSubviewToFront<span class="sy0">:</span><span class="br0">&#91;</span><span class="br0">&#40;</span>UIPanGestureRecognizer<span class="sy0">*</span><span class="br0">&#41;</span>sender view<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
CGPoint translatedPoint <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#40;</span>UIPanGestureRecognizer<span class="sy0">*</span><span class="br0">&#41;</span>sender translationInView<span class="sy0">:</span>self.view<span class="br0">&#93;</span>;<br />
<span class="kw1">if</span><span class="br0">&#40;</span><span class="br0">&#91;</span><span class="br0">&#40;</span>UIPanGestureRecognizer<span class="sy0">*</span><span class="br0">&#41;</span>sender state<span class="br0">&#93;</span> <span class="sy0">==</span> UIGestureRecognizerStateBegan<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
XPosition <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>sender view<span class="br0">&#93;</span> center<span class="br0">&#93;</span>.x;<br />
YPosition <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>sender view<span class="br0">&#93;</span> center<span class="br0">&#93;</span>.y;<br />
<span class="br0">&#125;</span><br />
translatedPoint <span class="sy0">=</span> CGPointMake<span class="br0">&#40;</span>XPosition<span class="sy0">+</span>translatedPoint.x, YPosition<span class="sy0">+</span>translatedPoint.y<span class="br0">&#41;</span>;<br />
<span class="br0">&#91;</span><span class="br0">&#91;</span>sender view<span class="br0">&#93;</span> setCenter<span class="sy0">:</span>translatedPoint<span class="br0">&#93;</span>;<br />
<span class="kw1">if</span><span class="br0">&#40;</span><span class="br0">&#91;</span><span class="br0">&#40;</span>UIPanGestureRecognizer<span class="sy0">*</span><span class="br0">&#41;</span>sender state<span class="br0">&#93;</span> <span class="sy0">==</span> UIGestureRecognizerStateEnded<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
CGFloat finalX <span class="sy0">=</span> translatedPoint.x <span class="sy0">+</span> <span class="br0">&#40;</span>.35<span class="sy0">*</span><span class="br0">&#91;</span><span class="br0">&#40;</span>UIPanGestureRecognizer<span class="sy0">*</span><span class="br0">&#41;</span>sender<br />
velocityInView<span class="sy0">:</span>self.view<span class="br0">&#93;</span>.x<span class="br0">&#41;</span>;<br />
CGFloat finalY <span class="sy0">=</span> translatedPoint.y <span class="sy0">+</span> <span class="br0">&#40;</span>.35<span class="sy0">*</span><span class="br0">&#91;</span><span class="br0">&#40;</span>UIPanGestureRecognizer<span class="sy0">*</span><span class="br0">&#41;</span>sender<br />
velocityInView<span class="sy0">:</span>self.view<span class="br0">&#93;</span>.y<span class="br0">&#41;</span>;<br />
<span class="kw1">if</span><span class="br0">&#40;</span>UIDeviceOrientationIsPortrait<span class="br0">&#40;</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UIDevice currentDevice<span class="br0">&#93;</span> orientation<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
<span class="kw1">if</span><span class="br0">&#40;</span>finalX &lt; 0<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
finalX <span class="sy0">=</span> <span class="nu0">0</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">else</span> <span class="kw1">if</span><span class="br0">&#40;</span>finalX &gt; 768<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
finalX <span class="sy0">=</span> <span class="nu0">768</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">if</span><span class="br0">&#40;</span>finalY &lt; 0<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
finalY <span class="sy0">=</span> <span class="nu0">0</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">else</span> <span class="kw1">if</span><span class="br0">&#40;</span>finalY &gt; 1024<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
finalY <span class="sy0">=</span> <span class="nu0">1024</span>;<br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><br />
<span class="kw1">else</span> <span class="br0">&#123;</span><br />
<span class="kw1">if</span><span class="br0">&#40;</span>finalX &lt; 0<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
finalX <span class="sy0">=</span> <span class="nu0">0</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">else</span> <span class="kw1">if</span><span class="br0">&#40;</span>finalX &gt; 1024<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
finalX <span class="sy0">=</span> <span class="nu0">768</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">if</span><span class="br0">&#40;</span>finalY &lt; 0<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
finalY <span class="sy0">=</span> <span class="nu0">0</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">else</span> <span class="kw1">if</span><span class="br0">&#40;</span>finalY &gt; 768<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
finalY <span class="sy0">=</span> <span class="nu0">1024</span>;<br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><br />
<span class="br0">&#91;</span>UIView beginAnimations<span class="sy0">:</span><span class="kw2">nil</span> context<span class="sy0">:</span><span class="kw2">NULL</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>UIView setAnimationDuration<span class="sy0">:</span>.35<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>UIView setAnimationCurve<span class="sy0">:</span>UIViewAnimationCurveEaseOut<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span><span class="br0">&#91;</span>sender view<span class="br0">&#93;</span> setCenter<span class="sy0">:</span>CGPointMake<span class="br0">&#40;</span>finalX, finalY<span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>UIView commitAnimations<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><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>tapped<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 />
<span class="br0">&#91;</span><span class="br0">&#91;</span><span class="br0">&#91;</span><span class="br0">&#40;</span>UITapGestureRecognizer<span class="sy0">*</span><span class="br0">&#41;</span>sender view<span class="br0">&#93;</span> layer<span class="br0">&#93;</span> removeAllAnimations<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>gestureRecognizer<span class="sy0">:</span><span class="br0">&#40;</span>UIGestureRecognizer <span class="sy0">*</span><span class="br0">&#41;</span>gestureRecognizer<br />
shouldRecognizeSimultaneouslyWithGestureRecognizer<span class="sy0">:</span><span class="br0">&#40;</span>UIGestureRecognizer<br />
<span class="sy0">*</span><span class="br0">&#41;</span>otherGestureRecognizer <span class="br0">&#123;</span><br />
<span class="kw1">return</span> <span class="sy0">!</span><span class="br0">&#91;</span>gestureRecognizer isKindOfClass<span class="sy0">:</span><span class="br0">&#91;</span>UIPanGestureRecognizer class<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="co1">#pragma mark &#8211; View lifecycle</span><br />
<span class="coMULTI">/*<br />
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.<br />
- (void)viewDidLoad<br />
{<br />
[super viewDidLoad];<br />
}<br />
*/</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidUnload<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super viewDidUnload<span class="br0">&#93;</span>;<br />
<span class="co2">// Release any retained subviews of the main view.</span><br />
<span class="co2">// e.g. self.myOutlet = nil;</span><br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>shouldAutorotateToInterfaceOrientation<span class="sy0">:</span><span class="br0">&#40;</span>UIInterfaceOrientation<span class="br0">&#41;</span>interfaceOrientation<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Return YES for supported orientations</span><br />
<span class="kw1">return</span> <span class="kw2">YES</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p>Step 8: Now Compile and run the application on the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/01/11.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/01/11-240x300.jpg" alt="" title="1" width="240" height="300" class="alignnone size-medium wp-image-3395" /></a></p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/01/11.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/01/11-240x300.jpg" alt="" title="1" width="240" height="300" class="alignnone size-medium wp-image-3395" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-apps/photos-application-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ImageClick Application in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-apps/imageclick-application-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-apps/imageclick-application-in-iphone/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 10:30:55 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Apps]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3387</guid>
		<description><![CDATA[In this application we will see how to image capture in iPhone without using camera. So let see how it will worked.
Step 1: Open the Xcode, Create a new project using View Base application. Give the application “ImageClick”.
Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to image capture in iPhone without using camera. So let see how it will worked.</p>
<p>Step 1: Open the Xcode, Create a new project using View Base application. Give the application “ImageClick”.</p>
<p>Step 2: 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>Step 3: Expand classes and notice Interface Builder created the ViewController class for you. Expand Resources and notice the template generated a separate nib, ImageClickViewController.xib for the ImageClick application.</p>
<p>Step 4: We need to add one image in the resource in the application. Give the name </p>
<p>Step 5: Open the ImageClickViewController.h file and make the following changes:</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> ImageClickViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
UIImageView <span class="sy0">*</span>image;<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 UIImageView <span class="sy0">*</span>image;<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>PhotoCapture<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender;<br />
<span class="kw1">@end</span></div>
</div>
<p>Step 6: Double click the ImageClickViewController.xib file and open it to the interface Builder. Drag the image view and round rect button from the library and place it to the View window. Now select the button and bring up Connection<br />
Inspector and connect Touch Up Inside to the File&#8217;s Owner icon and select PhotoCapture: method and select the imageview and bring up Attribute Inspector and select the background image.Now Save the .xib file, close it and go back to the Xcode.</p>
<p>Step 7: Open the ImageClickViewController.m file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;ImageClickViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> ImageClickViewController<br />
<span class="kw1">@synthesize</span> image;<br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>dealloc<br />
<span class="br0">&#123;</span><br />
<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><span class="kw4">void</span><span class="br0">&#41;</span>didReceiveMemoryWarning<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Releases the view if it doesn&#8217;t have a superview.</span><br />
<span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</span>;<br />
<span class="co2">// Release any cached data, images, etc that aren&#8217;t in use.</span><br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>PhotoCapture<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender<br />
<span class="br0">&#123;</span><br />
UIGraphicsBeginImageContext<span class="br0">&#40;</span>image.frame.size<span class="br0">&#41;</span>;<br />
<span class="br0">&#91;</span>self.view.layer renderInContext<span class="sy0">:</span>UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
UIImage <span class="sy0">*</span>viewImage <span class="sy0">=</span> UIGraphicsGetImageFromCurrentImageContext<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
UIGraphicsEndImageContext<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
UIImageWriteToSavedPhotosAlbum<span class="br0">&#40;</span>viewImage, <span class="kw2">nil</span>, <span class="kw2">nil</span>, <span class="kw2">nil</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="co1">#pragma mark &#8211; View lifecycle</span><br />
<span class="coMULTI">/*<br />
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.<br />
- (void)viewDidLoad<br />
{<br />
[super viewDidLoad];<br />
}<br />
*/</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidUnload<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super viewDidUnload<span class="br0">&#93;</span>;<br />
<span class="co2">// Release any retained subviews of the main view.</span><br />
<span class="co2">// e.g. self.myOutlet = nil;</span><br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>shouldAutorotateToInterfaceOrientation<span class="sy0">:</span><span class="br0">&#40;</span>UIInterfaceOrientation<span class="br0">&#41;</span>interfaceOrientation<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Return YES for supported orientations</span><br />
<span class="kw1">return</span> <span class="br0">&#40;</span>interfaceOrientation <span class="sy0">==</span> UIInterfaceOrientationPortrait<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p>Step 8: Now Compile and run the application on the Simulator. Click the “Capture Snap” button, it will automatically capture the background image and save it in the photos.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/01/1.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/01/1-160x300.jpg" alt="" title="1" width="160" height="300" class="alignnone size-medium wp-image-3388" /></a></p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2012/01/22.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/01/22-162x300.jpg" alt="" title="2" width="162" height="300" class="alignnone size-medium wp-image-3389" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-apps/imageclick-application-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get Current Latitude and Longitude in iPhone</title>
		<link>http://www.edumobile.org/iphone/miscellaneous/how-to-get-current-latitude-and-longitude-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/miscellaneous/how-to-get-current-latitude-and-longitude-in-iphone/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 10:25:00 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3383</guid>
		<description><![CDATA[In this application we will see how to get Current latitude and longitude using GPRS in the iPhone. So let see how it will worked. My last post you can get from here (attached the previous post link).
Step 1: Open the Xcode, Create a new project using View Base application. Give the application “Current_LatLong”.
Step 2: [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to get Current latitude and longitude using GPRS in the iPhone. So let see how it will worked. My last post you can get from here (attached the previous post link).</p>
<p>Step 1: Open the Xcode, Create a new project using View Base application. Give the application “Current_LatLong”.</p>
<p>Step 2: 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>Step 3: Expand classes and notice Interface Builder created the ViewController class for you. Expand Resources and notice the template generated a separate nib,.xib for the Current_LatLong application.</p>
<p>Step 4: We need to add CoreLocation.framework in the project.</p>
<p>Step 5: Open the Current_LatLongViewController.h file and make the following changes:</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;CoreLocation/CoreLocation.h&gt;</span><br />
<span class="kw1">@interface</span> Current_LatLongViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
CLLocationManager <span class="sy0">*</span>locationManager;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> CLLocationManager <span class="sy0">*</span>locationManager;<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>Button<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender;<br />
<span class="kw1">@end</span></div>
</div>
<p>Step 6: Double click the Current_LatLongViewController.xib file and open it to the Interface Builder. First drag the Round Rect Button from the library and place it to the view window. Now select the Round Rect button and bring up Connection Inspector and connect Touch Up inside to the File&#8217;s Owner icon and select Button: method. Now save the .xib file close it and go back to the Xcode. </p>
<p>Step 7: Open the Current_LatLongViewController.m file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;Current_LatLongViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> Current_LatLongViewController<br />
<span class="kw1">@synthesize</span> locationManager;<br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>dealloc<br />
<span class="br0">&#123;</span><br />
<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><span class="kw4">void</span><span class="br0">&#41;</span>didReceiveMemoryWarning<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Releases the view if it doesn&#8217;t have a superview.</span><br />
<span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</span>;<br />
<span class="co2">// Release any cached data, images, etc that aren&#8217;t in use.</span><br />
<span class="br0">&#125;</span><br />
<span class="co1">#pragma mark &#8211; View lifecycle</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidUnload<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super viewDidUnload<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>Button<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender<br />
<span class="br0">&#123;</span><br />
locationManager <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>CLLocationManager alloc<span class="br0">&#93;</span> init<span class="br0">&#93;</span>;<br />
locationManager.delegate <span class="sy0">=</span> self;<br />
locationManager.desiredAccuracy <span class="sy0">=</span> kCLLocationAccuracyBest;<br />
locationManager.distanceFilter <span class="sy0">=</span> kCLDistanceFilterNone;<br />
<span class="br0">&#91;</span>locationManager startUpdatingLocation<span class="br0">&#93;</span>;<br />
CLLocation <span class="sy0">*</span>location <span class="sy0">=</span> <span class="br0">&#91;</span>locationManager location<span class="br0">&#93;</span>;<br />
<span class="co2">// Configure the new event with information from the location</span><br />
CLLocationCoordinate2D coordinate <span class="sy0">=</span> <span class="br0">&#91;</span>location coordinate<span class="br0">&#93;</span>;<br />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>latitude <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><span class="co3">@</span><span class="st0">&quot;%f&quot;</span>, coordinate.latitude<span class="br0">&#93;</span>;<br />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>longitude <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><span class="co3">@</span><span class="st0">&quot;%f&quot;</span>, coordinate.longitude<span class="br0">&#93;</span>;<br />
NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;dLatitude : %@&quot;</span>, latitude<span class="br0">&#41;</span>;<br />
NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;dLongitude : %@&quot;</span>,longitude<span class="br0">&#41;</span>;<br />
UILabel <span class="sy0">*</span>label <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>50, 40, 250, 50<span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
UILabel <span class="sy0">*</span>myLabel <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>50, 80, 200, 50<span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
UILabel <span class="sy0">*</span>myLabel1 <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>50, 120, 200, 100<span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
myLabel.textColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor blackColor<span class="br0">&#93;</span>;<br />
myLabel1.textColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor blackColor<span class="br0">&#93;</span>;<br />
label.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor clearColor<span class="br0">&#93;</span>;<br />
myLabel.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor clearColor<span class="br0">&#93;</span>;<br />
myLabel1.backgroundColor <span class="sy0">=</span> <span class="br0">&#91;</span>UIColor clearColor<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>myLabel setText<span class="sy0">:</span>latitude<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>myLabel1 setText<span class="sy0">:</span>longitude<span class="br0">&#93;</span>;<br />
label.text <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;Current Latitude And Longitude&quot;</span>;<br />
<span class="br0">&#91;</span>self.view addSubview<span class="sy0">:</span>label<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.view addSubview<span class="sy0">:</span>myLabel<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.view addSubview<span class="sy0">:</span>myLabel1<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>shouldAutorotateToInterfaceOrientation<span class="sy0">:</span><span class="br0">&#40;</span>UIInterfaceOrientation<span class="br0">&#41;</span>interfaceOrientation<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Return YES for supported orientations</span><br />
<span class="kw1">return</span> <span class="br0">&#40;</span>interfaceOrientation <span class="sy0">==</span> UIInterfaceOrientationPortrait<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p>Step 8: Now compile and run the application on the actual device.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/miscellaneous/how-to-get-current-latitude-and-longitude-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

