<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>iPhone Tutorial &#124; iPhone iOS4 iPad SDK Development &#38; Programming Blog</title>
	<atom:link href="http://www.edumobile.org/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.edumobile.org/iphone</link>
	<description></description>
	<lastBuildDate>Wed, 25 Jan 2012 09:42:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>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>Wed, 25 Jan 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>
		<item>
		<title>EmailSend Application in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-apps/emailsend-application-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-apps/emailsend-application-in-iphone/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 10:40:08 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Apps]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3378</guid>
		<description><![CDATA[In this application we will see how to Email Send in iPhone. 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 View Base application. Give the application “EmailSend”.
Step 2: Xcode automatically creates the directory structure and [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to Email Send in iPhone. 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 View Base application. Give the application “EmailSend”.</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, EmailSendViewController.xib for the EmailSend application.</p>
<p>Step 4: We need to add MessageUI.framework in the application. </p>
<p>Step 5: Open the EmailSendViewController.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;MessageUI/MessageUI.h&gt;</span><br />
<span class="kw1">@interface</span> EmailSendViewController <span class="sy0">:</span> UIViewController<br />
&lt;MFMailComposeViewControllerDelegate&gt;<span class="br0">&#123;</span><br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>SendMail<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 EmailSendViewController.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 Connection Inspector and connect Touch Up Inside to the File&#8217;s Owner icon and select SendMail: method. Now Save the .xib file, close it and go back to the Xcode.</p>
<p>Step 7: Open the AlertViewViewController.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;EmailSendViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> EmailSendViewController<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="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="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>SendMail<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>MFMailComposeViewController canSendMail<span class="br0">&#93;</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
MFMailComposeViewController <span class="sy0">*</span>mailer <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>MFMailComposeViewController alloc<span class="br0">&#93;</span> init<span class="br0">&#93;</span>;<br />
mailer.mailComposeDelegate <span class="sy0">=</span> self;<br />
<span class="br0">&#91;</span>mailer setSubject<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;A Message from iPhone&quot;</span><span class="br0">&#93;</span>;<br />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>toRecipients <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> arrayWithObjects<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;&quot;</span>, <span class="co3">@</span><span class="st0">&quot;&quot;</span>, <span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>mailer setToRecipients<span class="sy0">:</span>toRecipients<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>emailBody <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;Have you Nice Day&quot;</span>;<br />
<span class="br0">&#91;</span>mailer setMessageBody<span class="sy0">:</span>emailBody isHTML<span class="sy0">:</span><span class="kw2">NO</span><span class="br0">&#93;</span>;<br />
<span class="co2">// only for iPad</span><br />
<span class="co2">// mailer.modalPresentationStyle = UIModalPresentationPageSheet;</span><br />
<span class="br0">&#91;</span>self presentModalViewController<span class="sy0">:</span>mailer animated<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>mailer release<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">else</span><br />
<span class="br0">&#123;</span><br />
UIAlertView <span class="sy0">*</span>alert <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIAlertView alloc<span class="br0">&#93;</span> initWithTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Failure&quot;</span><br />
message<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Your device doesn&#8217;t support the composer sheet&quot;</span><br />
delegate<span class="sy0">:</span><span class="kw2">nil</span><br />
cancelButtonTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;OK&quot;</span><br />
otherButtonTitles<span class="sy0">:</span> <span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>alert show<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>alert release<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><br />
<span class="co1">#pragma mark &#8211; MFMailComposeController delegate</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>mailComposeController<span class="sy0">:</span><span class="br0">&#40;</span>MFMailComposeViewController<span class="sy0">*</span><span class="br0">&#41;</span>controller didFinishWithResult<span class="sy0">:</span><br />
<span class="br0">&#40;</span>MFMailComposeResult<span class="br0">&#41;</span>result error<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/"><span class="kw5">NSError</span></a><span class="sy0">*</span><span class="br0">&#41;</span>error<br />
<span class="br0">&#123;</span><br />
<span class="kw1">switch</span> <span class="br0">&#40;</span>result<span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
<span class="kw1">case</span> MFMailComposeResultCancelled<span class="sy0">:</span><br />
NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;Mail cancelled&quot;</span><span class="br0">&#41;</span>;<br />
<span class="kw2">break</span>;<br />
<span class="kw1">case</span> MFMailComposeResultSaved<span class="sy0">:</span><br />
NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;Mail saved&quot;</span><span class="br0">&#41;</span>;<br />
<span class="kw2">break</span>;<br />
<span class="kw1">case</span> MFMailComposeResultSent<span class="sy0">:</span><br />
NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;Mail send&quot;</span><span class="br0">&#41;</span>;<br />
<span class="kw2">break</span>;<br />
<span class="kw1">case</span> MFMailComposeResultFailed<span class="sy0">:</span><br />
NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;Mail failed&quot;</span><span class="br0">&#41;</span>;<br />
<span class="kw2">break</span>;<br />
<span class="kw1">default</span><span class="sy0">:</span><br />
NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;Mail not sent&quot;</span><span class="br0">&#41;</span>;<br />
<span class="kw2">break</span>;<br />
<span class="br0">&#125;</span><br />
<span class="br0">&#91;</span>self dismissModalViewControllerAnimated<span class="sy0">:</span><span class="kw2">YES</span><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/EmailSend_Blog.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2012/01/EmailSend_Blog-152x300.jpg" alt="" title="EmailSend_Blog" width="152" height="300" class="alignnone size-medium wp-image-3379" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-apps/emailsend-application-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Table View Application in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/table-view-application-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/table-view-application-in-iphone/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 05:27:55 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3357</guid>
		<description><![CDATA[In this application we will see how to content delete , edit from the Table View. So let see how it will worked.
Step 1: Open the Xcode, Create a new project using View Base application. Give the application “TableView”.
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 content delete , edit from the Table 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 “TableView”.</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 FirstViewController and SecondViewController<br />
class for you. Expand Resources and notice the template generated a separate nib, TableViewViewController.xib for the TableView application.</p>
<p>Step 4: Open the TableViewAppDelegate.m file make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;TableViewAppDelegate.h&quot;</span><br />
<span class="co1">#import &quot;TableViewViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> TableViewAppDelegate<br />
<span class="kw1">@synthesize</span> window<span class="sy0">=</span>_window;<br />
<span class="kw1">@synthesize</span> viewController<span class="sy0">=</span>_viewController;<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> <span class="sy0">*</span><span class="br0">&#41;</span><br />
launchOptions<br />
<span class="br0">&#123;</span><br />
UINavigationController <span class="sy0">*</span>navController <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UINavigationController alloc<span class="br0">&#93;</span><br />
initWithRootViewController<span class="sy0">:</span>_viewController<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.window addSubview<span class="sy0">:</span>navController.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><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="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>_window release<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>_viewController release<span class="br0">&#93;</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 5: Open the TableViewViewController.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> TableViewViewController <span class="sy0">:</span> UIViewController &lt;UITableViewDelegate, UITableViewDataSource&gt;<br />
<span class="br0">&#123;</span><br />
IBOutlet UITableView <span class="sy0">*</span>tableView1;<br />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableArray_Class/"><span class="kw5">NSMutableArray</span></a> <span class="sy0">*</span>arry;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> EditTable<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 TableViewViewController.xib file and open it to the Interface Builder. First drag the table view from the library and place it to the view window.Select the Table View from the view and bring up Connection Inspector and connect datasource to File&#8217;s owner icon and delegate to the File&#8217;s owner icon. Now save the .xib file, close it and go back to the Xcode.</p>
<p>Step 7: Open the TableViewViewController.m file make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;TableViewViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> TableViewViewController<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 />
arry <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/NSMutableArray_Class/"><span class="kw5">NSMutableArray</span></a> alloc<span class="br0">&#93;</span><br />
initWithObjects<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;iPhone&quot;</span>,<span class="co3">@</span><span class="st0">&quot;MacMini&quot;</span>,<span class="co3">@</span><span class="st0">&quot;iMac&quot;</span>,<span class="co3">@</span><span class="st0">&quot;MacBookProAir&quot;</span>,<span class="co3">@</span><span class="st0">&quot;MacBookPro&quot;</span>,<span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
self.title <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;Table View &quot;</span>;<br />
UIBarButtonItem <span class="sy0">*</span>addButton <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIBarButtonItem alloc<span class="br0">&#93;</span> initWithTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Edit&quot;</span><br />
style<span class="sy0">:</span>UIBarButtonItemStyleBordered target<span class="sy0">:</span>self action<span class="sy0">:</span><span class="kw1">@selector</span><span class="br0">&#40;</span>EditTable<span class="sy0">:</span><span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.navigationItem setLeftBarButtonItem<span class="sy0">:</span>addButton<span class="br0">&#93;</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<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super didReceiveMemoryWarning<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>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="co1">#pragma mark Table view methods</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>numberOfSectionsInTableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView<br />
<span class="br0">&#123;</span><br />
<span class="kw1">return</span> <span class="nu0">1</span>;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>tableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView numberOfRowsInSection<span class="sy0">:</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>section<br />
<span class="br0">&#123;</span><br />
<span class="kw4">int</span> count <span class="sy0">=</span> <span class="br0">&#91;</span>arry count<span class="br0">&#93;</span>;<br />
<span class="kw1">if</span><span class="br0">&#40;</span>self.editing<span class="br0">&#41;</span> count<span class="sy0">++</span>;<br />
<span class="kw1">return</span> count;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>UITableViewCell <span class="sy0">*</span><span class="br0">&#41;</span>tableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView cellForRowAtIndexPath<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span class="kw5">NSIndexPath</span></a> <span class="sy0">*</span><span class="br0">&#41;</span><br />
indexPath<br />
<span class="br0">&#123;</span><br />
<span class="kw4">static</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>CellIdentifier <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;Cell&quot;</span>;<br />
UITableViewCell <span class="sy0">*</span>cell <span class="sy0">=</span> <span class="br0">&#91;</span>tableView dequeueReusableCellWithIdentifier<span class="sy0">:</span>CellIdentifier<span class="br0">&#93;</span>;<br />
<span class="kw1">if</span> <span class="br0">&#40;</span>cell <span class="sy0">==</span> <span class="kw2">nil</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
cell <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UITableViewCell alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span>CGRectZero reuseIdentifier<span class="sy0">:</span>CellIdentifier<span class="br0">&#93;</span> autorelease<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw4">int</span> count <span class="sy0">=</span> <span class="nu0">0</span>;<br />
<span class="kw1">if</span><span class="br0">&#40;</span>self.editing <span class="sy0">&amp;&amp;</span> indexPath.row <span class="sy0">!=</span> 0<span class="br0">&#41;</span><br />
count <span class="sy0">=</span> <span class="nu0">1</span>;<br />
<span class="kw1">if</span><span class="br0">&#40;</span>indexPath.row <span class="sy0">==</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>arry count<span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="sy0">&amp;&amp;</span> self.editing<span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
cell.textLabel.text <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;ADD&quot;</span>;<br />
<span class="kw1">return</span> cell;<br />
<span class="br0">&#125;</span><br />
cell.textLabel.text <span class="sy0">=</span> <span class="br0">&#91;</span>arry objectAtIndex<span class="sy0">:</span>indexPath.row<span class="br0">&#93;</span>;<br />
<span class="kw1">return</span> cell;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>AddButtonAction<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="br0">&#91;</span>arry addObject<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;MacBookPro &quot;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>tableView1 reloadData<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>DeleteButtonAction<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="br0">&#91;</span>arry removeLastObject<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>tableView1 reloadData<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> EditTable<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>self.editing<span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super setEditing<span class="sy0">:</span><span class="kw2">NO</span> animated<span class="sy0">:</span><span class="kw2">NO</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>tableView1 setEditing<span class="sy0">:</span><span class="kw2">NO</span> animated<span class="sy0">:</span><span class="kw2">NO</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>tableView1 reloadData<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.navigationItem.leftBarButtonItem setTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Edit&quot;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.navigationItem.leftBarButtonItem setStyle<span class="sy0">:</span>UIBarButtonItemStylePlain<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">else</span><br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super setEditing<span class="sy0">:</span><span class="kw2">YES</span> animated<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>tableView1 setEditing<span class="sy0">:</span><span class="kw2">YES</span> animated<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>tableView1 reloadData<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.navigationItem.leftBarButtonItem setTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Done&quot;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.navigationItem.leftBarButtonItem setStyle<span class="sy0">:</span>UIBarButtonItemStyleDone<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>UITableViewCellEditingStyle<span class="br0">&#41;</span>tableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>aTableView editingStyleForRowAtIndexPath<span class="sy0">:</span><br />
<span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span class="kw5">NSIndexPath</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>indexPath<br />
<span class="br0">&#123;</span><br />
<span class="kw1">if</span> <span class="br0">&#40;</span>self.editing <span class="sy0">==</span> <span class="kw2">NO</span> || <span class="sy0">!</span>indexPath<span class="br0">&#41;</span> <span class="kw1">return</span> UITableViewCellEditingStyleNone;<br />
<span class="kw1">if</span> <span class="br0">&#40;</span>self.editing <span class="sy0">&amp;&amp;</span> indexPath.row <span class="sy0">==</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>arry count<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
<span class="kw1">return</span> UITableViewCellEditingStyleInsert;<br />
<span class="br0">&#125;</span> <span class="kw1">else</span><br />
<span class="br0">&#123;</span><br />
<span class="kw1">return</span> UITableViewCellEditingStyleDelete;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">return</span> UITableViewCellEditingStyleNone;<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>tableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>aTableView commitEditingStyle<span class="sy0">:</span><span class="br0">&#40;</span>UITableViewCellEditingStyle<span class="br0">&#41;</span><br />
editingStyle<br />
forRowAtIndexPath<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span class="kw5">NSIndexPath</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>indexPath<br />
<span class="br0">&#123;</span><br />
<span class="kw1">if</span> <span class="br0">&#40;</span>editingStyle <span class="sy0">==</span> UITableViewCellEditingStyleDelete<span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>arry removeObjectAtIndex<span class="sy0">:</span>indexPath.row<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>tableView1 reloadData<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>editingStyle <span class="sy0">==</span> UITableViewCellEditingStyleInsert<span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>arry insertObject<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;MacBookPro&quot;</span> atIndex<span class="sy0">:</span><span class="br0">&#91;</span>arry count<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>tableView1 reloadData<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><br />
<span class="co1">#pragma mark Row reordering</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>tableView<span class="sy0">:</span><span class="br0">&#40;</span>UITableView <span class="sy0">*</span><span class="br0">&#41;</span>tableView canMoveRowAtIndexPath<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span class="kw5">NSIndexPath</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>indexPath<br />
<span class="br0">&#123;</span><br />
<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/2011/09/113.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/113-160x300.jpg" alt="" title="1" width="160" height="300" class="alignnone size-medium wp-image-3358" /></a></p>
<p>You can Download SourceCode from <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/09/TableView.zip'>here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/table-view-application-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programmatically Segmented Control in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/programmatically-segmented-control-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/programmatically-segmented-control-in-iphone/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 05:14:15 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3351</guid>
		<description><![CDATA[In this application we will see how to implement Segmented Control programmatically 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
“ProgrammaticallySegmentedControl”.
Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the
directory structure to check [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to implement Segmented Control programmatically in iPhone. So let see how it will<br />
worked.</p>
<p>Step 1: Open the Xcode, Create a new project using View Base application. Give the application<br />
“ProgrammaticallySegmentedControl”.</p>
<p>Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the<br />
directory structure to check out the content of the directory.</p>
<p>Step 3: Expand classes and notice Interface Builder created the FirstViewController and SecondViewController class<br />
for you. Expand Resources and notice the template generated a separate nib,<br />
ProgrammaticallySegmentedControlViewController.xib for the ProgrammaticallySegmentedControl application.</p>
<p>Step 4: Open the ProgrammaticallySegmentedControlViewController.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;programmaticallySegmentedControlViewController.h&quot;</span><br />
<span class="co1">#define HeightSegmControl 40.0</span><br />
<span class="co1">#define TextHeight 30.0</span><br />
<span class="co1">#define LeftMargin 30.0</span><br />
<span class="co1">#define RightMargin 30.0</span><br />
<span class="co1">#define TweenMargin 30.0</span><br />
<span class="kw1">@implementation</span> programmaticallySegmentedControlViewController<br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>SegmentControl<br />
<span class="br0">&#123;</span><br />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>text <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> arrayWithObjects<span class="sy0">:</span> <span class="co3">@</span><span class="st0">&quot; Segmented&quot;</span>, <span class="co3">@</span><span class="st0">&quot;Control&quot;</span>, <span class="co3">@</span><span class="st0">&quot;iPhone&quot;</span>, <span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
CGFloat yPlacement <span class="sy0">=</span> <span class="br0">&#40;</span>TweenMargin <span class="sy0">*</span> 3.0<span class="br0">&#41;</span> <span class="sy0">+</span> HeightSegmControl;<br />
CGRect frame<span class="sy0">=</span>CGRectMake<span class="br0">&#40;</span>LeftMargin, yPlacement, self.view.bounds.size.width<span class="sy0">-</span><span class="br0">&#40;</span>RightMargin <span class="sy0">*</span><br />
3.0<span class="br0">&#41;</span>,TextHeight<span class="br0">&#41;</span>;<br />
UISegmentedControl <span class="sy0">*</span>control<span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UISegmentedControl alloc<span class="br0">&#93;</span> initWithItems<span class="sy0">:</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> arrayWithObjects<span class="sy0">:</span> <span class="kw2">nil</span><span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
control <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UISegmentedControl alloc<span class="br0">&#93;</span> initWithItems<span class="sy0">:</span>text<span class="br0">&#93;</span>;<br />
control.frame <span class="sy0">=</span> frame;<br />
<span class="co2">//control.selectedSegmentIndex = 0;</span><br />
<span class="br0">&#91;</span>self.view addSubview<span class="sy0">:</span>control<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>control release<span class="br0">&#93;</span>;<br />
<span class="co2">// label</span><br />
<span class="co2">//yPlacement += (mTweenMargin * 3.0) + mSegmentedControlHeight;</span><br />
control <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UISegmentedControl alloc<span class="br0">&#93;</span> initWithItems<span class="sy0">:</span>text<span class="br0">&#93;</span>;<br />
frame <span class="sy0">=</span> CGRectMake<span class="br0">&#40;</span>LeftMargin,yPlacement,self.view.bounds.size.width<span class="sy0">-</span><span class="br0">&#40;</span>RightMargin <span class="sy0">*</span><br />
2.0<span class="br0">&#41;</span>,HeightSegmControl<span class="br0">&#41;</span>;<br />
control.frame <span class="sy0">=</span> frame;<br />
control.segmentedControlStyle <span class="sy0">=</span> UISegmentedControlStyleBar;<br />
<span class="co2">//control.tintColor = [UIColor colorWithRed:0.80 green:0.171 blue:0.5 alpha:1.0];</span><br />
control.selectedSegmentIndex <span class="sy0">=</span> <span class="nu0">1</span>;<br />
<span class="br0">&#91;</span>self.view addSubview<span class="sy0">:</span>control<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>control release<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>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="co2">// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self SegmentControl<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>segmentAction<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><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 5: Now Compile and run the application on the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/112.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/112-168x300.jpg" alt="" title="1" width="168" height="300" class="alignnone size-medium wp-image-3352" /></a></p>
<p>You can Download SourceCode from <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/09/programmaticallySegmentedControl.zip'>here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/programmatically-segmented-control-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UIButton Example in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/uibutton-example-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/uibutton-example-in-iphone/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 05:09:08 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3344</guid>
		<description><![CDATA[In this example we will see how to display DatePicker view after pressing button. So let see how it will worked.
Step 1: Open the Xcode, Create a new project using View Base application. Give the application “Button_Fun”.
Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the
directory structure [...]]]></description>
			<content:encoded><![CDATA[<p>In this example we will see how to display DatePicker view after pressing button. 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 “Button_Fun”.</p>
<p>Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the<br />
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<br />
the template generated a separate nib, Button_FunViewController.xib for the Button_Fun.</p>
<p>Step 4: We need to add one UIViewController class in the application. So select New File -> Cocoa Touch -><br />
UIViewController subclass, and give the class name &#8220;Date Picker&#8221;.</p>
<p>Step 5: Open the Button_FunViewController.h file and make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span><br />
<span class="kw1">@class</span> DatePicker;<br />
<span class="kw1">@interface</span> Button_FunViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
DatePicker <span class="sy0">*</span>datePicker;<br />
IBOutlet UIButton <span class="sy0">*</span>button;<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="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> nextview<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 Button_FunViewController.xib file and open it to the Interface Builder. Drag the Round Rect<br />
button from the library and place it to the view window. Select the button and bring up Connection Inspector connect Touch Up Inside to the File&#8217;s owner icon and select nextview: method. Now save the .xib file , close it and go back to the Xcode.</p>
<p>Step 7: Open the Button_FunViewController.m file and make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;Button_FunViewController.h&quot;</span><br />
<span class="co1">#import &quot;DatePicker.h&quot;</span><br />
<span class="kw1">@implementation</span> Button_FunViewController<br />
<span class="kw1">@synthesize</span> button;<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> nextview<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 />
datePicker <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>DatePicker alloc<span class="br0">&#93;</span><br />
initWithNibName<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;DatePicker&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.view addSubview<span class="sy0">:</span>datePicker.view<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>dealloc<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super dealloc<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>datePicker release<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="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="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: Open the DatePicker.h file and make the following change:</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> DatePicker <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
IBOutlet UIDatePicker <span class="sy0">*</span>datePicker;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> previousview<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 9: Double click the DatePicker.xib file and open it to the Interface Builder. First drag the date picker from library and<br />
place it to the view window. Connect File&#8217;s Owner icon to the DatePicker and select datePicker. Now drag the Round Rect<br />
Button and place it to the view window. Select the button and bring up connection inspector and connect Touch Up Inside to the File&#8217;s owner icon and select previousview: method. Now save the .xib file, close it and go back to the Xcode.</p>
<p>Step 10: Open the DatePicker.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;DatePicker.h&quot;</span><br />
<span class="kw1">@implementation</span> DatePicker<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> previousview<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="br0">&#91;</span>self.view removeFromSuperview<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>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>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="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 11: Now Compile and Run the application on the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/111.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/111-160x300.jpg" alt="" title="1" width="160" height="300" class="alignnone size-medium wp-image-3345" /></a></p>
<p>You can Download SourceCode from <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/09/Button_Fun.zip'>Button_Fun</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/uibutton-example-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alert View Application in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/alert-view-application-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/alert-view-application-in-iphone/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 04:37:04 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3338</guid>
		<description><![CDATA[In this application we will see how to AlertView display after button pressed 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
“AlertView”. 
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 AlertView display after button pressed in iPhone. So let see how it will<br />
worked. </p>
<p>Step 1: Open the Xcode, Create a new project using View Base application. Give the application<br />
“AlertView”. </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, AlertViewViewController.xib for the AlertView application.</p>
<p>Step 4: Open the AlertViewViewController.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> AlertViewViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
IBOutlet UITextField <span class="sy0">*</span>text;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>AlertView<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 AlertViewViewController.xib file and open it to the interface Builder. Drag the Textfield, Label and round rect button from the library and place it to the View window. Now connect File&#8217;s Owner icon to the TextField and select text, select the button and bring up Connection Inspector and connect Touch Up Inside to the File&#8217;s Owner icon and select AlertView: method. Now Save the .xib file, close it and go back to the Xcode.</p>
<p>Step 6: Open the AlertViewViewController.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;AlertViewViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> AlertViewViewController<br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>AlertView<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>text.text length<span class="br0">&#93;</span><span class="sy0">==</span><span class="nu0">0</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
UIAlertView <span class="sy0">*</span> alert <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIAlertView alloc<span class="br0">&#93;</span> initWithTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;&quot;</span><br />
message<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Enter Your Name&quot;</span><br />
delegate<span class="sy0">:</span>self<br />
cancelButtonTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;OK&quot;</span><br />
otherButtonTitles<span class="sy0">:</span> <span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>alert show<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span><span class="br0">&#91;</span><br />
text resignFirstResponder<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>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="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 7: Now Compile and run the application on the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/110.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/110-150x150.jpg" alt="" title="1" width="150" height="150" class="alignnone size-thumbnail wp-image-3339" /></a></p>
<p>You can Download SourceCode from <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/09/AlertView.zip'>AlertView</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/alert-view-application-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Touch Function in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/touch-function-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/touch-function-in-iphone/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 04:31:42 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3332</guid>
		<description><![CDATA[In this application we will see how to multiple images moved using touch function. So let see how it will worked.
Step 1: Open the Xcode, Create a new project using View Base application. Give the application “TouchFunction”.
Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore
the directory structure [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to multiple images moved using touch function. 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 “TouchFunction”.</p>
<p>Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore<br />
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<br />
and notice the template generated a separate nib, TouchFunctionViewController.xib for the TouchFunction<br />
application.</p>
<p>Step 4: we need to add resources in the application.</p>
<p>Step 5: Open the TouchFunctionViewController.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> TouchFunctionViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
IBOutlet UIImageView <span class="sy0">*</span>image;<br />
IBOutlet UIImageView <span class="sy0">*</span>image1;<br />
IBOutlet UIImageView <span class="sy0">*</span>image2;<br />
IBOutlet UIImageView <span class="sy0">*</span>image3;<br />
IBOutlet UIImageView <span class="sy0">*</span>image4;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p>Step 6: Double click the TouchFunctionViewController.xib file and open it to the interface builder. First select the<br />
view and bring up Attribute Inspector and change the background color. First drag the five ImageView from the<br />
library and place it to the view window. Select the Image Views from the view and bring up Attribute Inspector and<br />
select the litchi.png, raspberries.png, starfruits.png, apple.png,orange.png images. Connect File’s Owner icon to the<br />
image views and select image, image1,image2, image3, image4. Now save the .xib file, save it and go back to the<br />
Xcode.</p>
<p>Step 7: Open the TouchFunctionViewController.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;TouchFunctionViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> TouchFunctionViewController<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<br />
<span class="br0">&#123;</span><br />
<span class="co2">// get touch event</span><br />
UITouch <span class="sy0">*</span>touch <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>event allTouches<span class="br0">&#93;</span> anyObject<span class="br0">&#93;</span>;<br />
CGPoint touchLocation <span class="sy0">=</span> <span class="br0">&#91;</span>touch locationInView<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>touch view<span class="br0">&#93;</span> <span class="sy0">==</span> image<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
image.center <span class="sy0">=</span> touchLocation;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>touch view<span class="br0">&#93;</span> <span class="sy0">==</span> image1<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
image1.center <span class="sy0">=</span> touchLocation;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>touch view<span class="br0">&#93;</span> <span class="sy0">==</span> image2<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
image2.center <span class="sy0">=</span> touchLocation;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>touch view<span class="br0">&#93;</span> <span class="sy0">==</span> image3<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
image3.center <span class="sy0">=</span> touchLocation;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>touch view<span class="br0">&#93;</span> <span class="sy0">==</span> image4<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
image4.center <span class="sy0">=</span> touchLocation;<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>didReceiveMemoryWarning<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</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><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/2011/09/19.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/19-164x300.jpg" alt="" title="1" width="164" height="300" class="alignnone size-medium wp-image-3328" /></a></p>
<p>You can Download SourceCode from <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/09/TouchFunction.zip'>here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/touch-function-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Time Application in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-interface-builder/time-application-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-interface-builder/time-application-in-iphone/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 04:26:07 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Interface Builder]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3318</guid>
		<description><![CDATA[In this application we will see how to Current time display in the application. So let see how it
will worked.
Step 1: Open the Xcode, Create a new project using View Base application. Give the application
“TimeApplication”.
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 Current time display in the application. So let see how it<br />
will worked.</p>
<p>Step 1: Open the Xcode, Create a new project using View Base application. Give the application<br />
“TimeApplication”.</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, TimeApplicationViewController.xib for the TimeApplication.</p>
<p>Step 4: Open the TimeApplicationViewController.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> TimeApplicationViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
IBOutlet UIButton <span class="sy0">*</span>submit;<br />
IBOutlet UILabel <span class="sy0">*</span><a href="http://www.opengroup.org/onlinepubs/009695399/functions/time.html"><span class="kw3">time</span></a>;<br />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>data;<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>submit;<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>data;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UILabel <span class="sy0">*</span><a href="http://www.opengroup.org/onlinepubs/009695399/functions/time.html"><span class="kw3">time</span></a>;<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>ShowTime<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 TimeApplicationViewController.xib file and open it to the Interface Builder. First drag the Round Rect Button and label 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 ShowTime: method. Select File&#8217;s Owner icon to the label and select time. Now save the .sib file close it and go back to the Xcode.</p>
<p>Step 6: Open the TimeApplicationViewController.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;TimeApplicationViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> TimeApplicationViewController<br />
<span class="kw1">@synthesize</span> submit, <a href="http://www.opengroup.org/onlinepubs/009695399/functions/time.html"><span class="kw3">time</span></a>, data;<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>ShowTime<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><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>autorelease<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;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 />
NSLog<span class="br0">&#40;</span>str<span class="br0">&#41;</span>;<br />
<span class="br0">&#91;</span><a href="http://www.opengroup.org/onlinepubs/009695399/functions/time.html"><span class="kw3">time</span></a> 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">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="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</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><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> 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<br />
<a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/18.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/18-166x300.jpg" alt="" title="1" width="166" height="300" class="alignnone size-medium wp-image-3319" /></a></p>
<p>You can Download SourceCode from <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/09/TimeApplication.zip'>here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-interface-builder/time-application-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Text Field With Number in iPhone</title>
		<link>http://www.edumobile.org/iphone/miscellaneous/text-field-with-number-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/miscellaneous/text-field-with-number-in-iphone/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 04:17:59 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3310</guid>
		<description><![CDATA[In this example we will see how to enter limited number in the TextField. So let see how it will worked.
Step 1: Open the Xcode, Create a new project using View Base application. Give the application “TextFieldWithNumber”.
Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory [...]]]></description>
			<content:encoded><![CDATA[<p>In this example we will see how to enter limited number in the TextField. 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 “TextFieldWithNumber”.</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<br />
the template generated a separate nib, TextFieldWithNumber.xib for the TextFieldWithNumber application.</p>
<p>Step 4: Open the TextFieldWithNumberViewController.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> TextFieldWithNumberViewController <span class="sy0">:</span> UIViewController &lt; UITextFieldDelegate &gt; <span class="br0">&#123;</span><br />
IBOutlet UITextField <span class="sy0">*</span>text;<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 UITextField <span class="sy0">*</span>text;<br />
<span class="kw1">@end</span></div>
</div>
<p>Step 5: Double click the TextFieldWithNumber.xib file and open it to the interface builder. First drag the TextField from the<br />
library and place it to the view window. Select theTextField and bring up Connection Inspector, connect delegate to the File&#8217;s Owner icon and connect File&#8217;s Owner icon to the textfield and select text. Now save the .xib file, close it and go back to the Xcode.</p>
<p>Step 6: Open the TextFieldWithNumberViewController.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;TextFieldWithNumberViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> TextFieldWithNumberViewController<br />
<span class="kw1">@synthesize</span> text;<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 />
text.delegate <span class="sy0">=</span> self;<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">BOOL</span><span class="br0">&#41;</span>textFieldShouldReturn<span class="sy0">:</span><span class="br0">&#40;</span>UITextField <span class="sy0">*</span><span class="br0">&#41;</span>textField<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>textField resignFirstResponder<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>didReceiveMemoryWarning <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><span class="kw4">BOOL</span><span class="br0">&#41;</span>textField<span class="sy0">:</span><span class="br0">&#40;</span>UITextField <span class="sy0">*</span><span class="br0">&#41;</span>textField shouldChangeCharactersInRange<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">NSRange</span><span class="br0">&#41;</span>range replacementString<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><span class="kw4">string</span><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>newString <span class="sy0">=</span> <span class="br0">&#91;</span>textField.text stringByReplacingCharactersInRange<span class="sy0">:</span>range withString<span class="sy0">:</span><span class="kw4">string</span><span class="br0">&#93;</span>;<br />
<span class="kw1">if</span><span class="br0">&#40;</span><span class="br0">&#91;</span>newString length<span class="br0">&#93;</span> &gt; <span class="nu0">8</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
UIAlertView <span class="sy0">*</span>obj_AlertView<span class="sy0">=</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UIAlertView alloc<span class="br0">&#93;</span>initWithTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;&quot;</span><br />
message<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Enter 8 digit only&quot;</span><br />
delegate<span class="sy0">:</span>self<br />
cancelButtonTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;OK&quot;</span><br />
otherButtonTitles<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>obj_AlertView show<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>obj_AlertView release<span class="br0">&#93;</span>;<br />
<span class="kw1">return</span> <span class="sy0">!</span><span class="br0">&#40;</span><span class="br0">&#91;</span>newString length<span class="br0">&#93;</span> &gt; 8<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>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<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>text resignFirstResponder<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>super touchesBegan<span class="sy0">:</span>touches withEvent<span class="sy0">:</span>event<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>viewDidUnload <span class="br0">&#123;</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/2011/09/17.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/17-161x300.jpg" alt="" title="1" width="161" height="300" class="alignnone size-medium wp-image-3311" /></a></p>
<p>You Can Download SourceCode from <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/09/TextFieldWithNumber.zip'>here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/miscellaneous/text-field-with-number-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebView Application in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/webview-application-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/webview-application-in-iphone/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 04:10:54 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3305</guid>
		<description><![CDATA[In this application we will see how to WebView display in the view window . So let see how it will worked.
Step 1: Open the Xcode, Create a new project using View Base application. Give the application “MapViewiPhone”.
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 WebView display in the view window . 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 “MapViewiPhone”.</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, MapViewiPhoneViewController.xib for the MapViewiPhone application.</p>
<p>Step 4: We need to add MapKit.framework in the Frameworks folder.</p>
<p>Step 5: Open the  MapViewiPhoneViewController.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;MapKit/MapKit.h&gt;</span><br />
<span class="kw1">@interface</span> MapViewiPhoneViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; IBOutlet MKMapView <span class="sy0">*</span>map;<br />
&nbsp; &nbsp; <br />
<span class="br0">&#125;</span><br />
<span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet MKMapView <span class="sy0">*</span>map;</p>
<p><span class="kw1">@end</span></div>
</div>
<p>Step 6: Double click the MapViewiPhoneViewController.xib file and open it to the Interface Builder. First drag the mapview from the library and place it to the View window. Connect File&#8217;s Owner icon to the view window and select map. Now save the .xib file, close it , and go back to the Xcode.</p>
<p>Step 7: Open the  MapViewiPhoneViewController.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;MapViewiPhoneViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> MapViewiPhoneViewController</p>
<p><span class="kw1">@synthesize</span> map;</p>
<p><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 />
&nbsp; &nbsp; <span class="br0">&#91;</span>super dealloc<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>didReceiveMemoryWarning<br />
<span class="br0">&#123;</span><br />
&nbsp;<br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <br />
<span class="br0">&#125;</span><br />
<span class="co1">#pragma mark &#8211; View lifecycle</span><br />
<span class="co2">// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; map.mapType <span class="sy0">=</span> MKMapTypeSatellite;<br />
&nbsp; &nbsp; &nbsp; &nbsp; map.mapType<span class="sy0">=</span>MKMapTypeStandard;<br />
&nbsp; &nbsp; &nbsp; &nbsp; </p>
<p><span class="br0">&#125;</span></p>
<p>
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidUnload<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidUnload<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>shouldAutorotateToInterfaceOrientation<span class="sy0">:</span><span class="br0">&#40;</span>UIInterfaceOrientation<span class="br0">&#41;</span>interfaceOrientation<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="co2">// Return YES for supported orientations</span><br />
&nbsp; &nbsp; <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/2011/09/16.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/16-161x300.jpg" alt="" title="1" width="161" height="300" class="alignleft size-medium wp-image-3306" /></a></p>
<p>You can Download SourceCode from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/09/MapViewiPhone.zip'>MapViewiPhone</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/webview-application-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SplashScreen With WebView in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-interface-builder/splashscreen-with-webview-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-interface-builder/splashscreen-with-webview-in-iphone/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 03:55:48 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Interface Builder]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3297</guid>
		<description><![CDATA[In this application we will see how to WebView display after SplashScreen. So let see how it will worked.
Step 1: Open the Xcode, Create a new project using Window Base application. Give the application “SplashWithWeb”.
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 WebView display after SplashScreen. So let see how it will worked.</p>
<p>Step 1: Open the Xcode, Create a new project using Window Base application. Give the application “SplashWithWeb”.</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 AppDelegate class for you. Expand Resources and notice the template generated a separate nib, MainWindow.xib for the SplashWithWeb application.</p>
<p>Step 4: We need to add background resources in the resource folder. Give the resource name “1.png”.</p>
<p>Step 5: We need to add UIViewController class in the application. Select NewFile -> UIViewController sub class -> and give the class name “WebViewDisplay”.</p>
<p>Step 6: Open the SplashWithWebAppDelegate.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> WebViewDisplay;<br />
<span class="kw1">@interface</span> SplashWithWebAppDelegate <span class="sy0">:</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span class="kw5">NSObject</span></a> &lt;UIApplicationDelegate&gt; <span class="br0">&#123;</span><br />
WebViewDisplay <span class="sy0">*</span>webViewDisplay;<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 UIWindow <span class="sy0">*</span>window;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet WebViewDisplay <span class="sy0">*</span>webViewDisplay;<br />
<span class="kw1">@end</span></div>
</div>
<p>Step 7: Select SplashWithWeb project from the Xcode , go to TARGETS -> SplashWithWeb -> Summary -> Launch images . Select the background image.</p>
<p>Step 8: In the SplashWithWebAppDelegate.m file make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;SplashWithWebAppDelegate.h&quot;</span><br />
<span class="co1">#import &quot;WebViewDisplay.h&quot;</span><br />
<span class="kw1">@implementation</span> SplashWithWebAppDelegate<br />
<span class="kw1">@synthesize</span> window<span class="sy0">=</span>_window , webViewDisplay;<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> <span class="sy0">*</span><span class="br0">&#41;</span>launchOptions<br />
<span class="br0">&#123;</span><br />
<span class="co2">// Override point for customization after application launch.</span><br />
webViewDisplay <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>WebViewDisplay alloc<span class="br0">&#93;</span>initWithNibName<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;WebViewDisplay&quot;</span> bundle<span class="sy0">:</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span class="kw5">NSBundle</span></a> mainBundle<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>_window addSubview<span class="sy0">:</span>webViewDisplay.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="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="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>_window release<span class="br0">&#93;</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 9: Open the WebViewDisplay.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> WebViewDisplay <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
IBOutlet UIWebView <span class="sy0">*</span>webDisplay;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic,retain<span class="br0">&#41;</span> UIWebView <span class="sy0">*</span>webDisplay;<br />
<span class="kw1">@end</span></div>
</div>
<p>Step 10: Double click the WebViewDisplay.xib file and open it to the Interface Builder. First drag the WebView from the library and place it to the view window. Connect File&#8217;s owner icon to the WebView and select webDisplay. Now save the .xib file and go back to the Xcode.</p>
<p>Step 11: WebViewDisplay.m file make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;WebViewDisplay.h&quot;</span><br />
<span class="kw1">@implementation</span> WebViewDisplay<br />
<span class="kw1">@synthesize</span> webDisplay;<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>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="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</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 />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>urlAddress <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;http://www.google.com&quot;</span>;<br />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> <span class="sy0">*</span>url <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> URLWithString<span class="sy0">:</span>urlAddress<span class="br0">&#93;</span>;<br />
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/"><span class="kw5">NSURLRequest</span></a> <span class="sy0">*</span>requestObj <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/"><span class="kw5">NSURLRequest</span></a> requestWithURL<span class="sy0">:</span>url<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>webDisplay loadRequest<span class="sy0">:</span>requestObj<span class="br0">&#93;</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>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><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> UIInterfaceOrientationPortrait<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@end</span></div>
</div>
<p>Step 12: Now compile and run the application on the simulator.<br />
<a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/15.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/15-162x300.jpg" alt="" title="1" width="162" height="300" class="alignnone size-medium wp-image-3298" /></a></p>
<p>You can Download SourceCode from <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/09/SplashWithWeb.zip'>here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-interface-builder/splashscreen-with-webview-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Segment Control in TabBar Application in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/segment-control-in-tabbar-application-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/segment-control-in-tabbar-application-in-iphone/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 04:23:33 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3287</guid>
		<description><![CDATA[In this application we will see how to change the background color using segmentControl, in TabBar Application . So let see how it will worked.
Step 1: Open the Xcode, Create a new project using TabBar Base application. Give the application “TabBarWithSegmentControl”.
Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to change the background color using segmentControl, in TabBar Application . So let see how it will worked.</p>
<p>Step 1: Open the Xcode, Create a new project using TabBar Base application. Give the application “TabBarWithSegmentControl”.</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 FirstViewController and SecondViewController class for you. Expand Resources and notice the template generated a separate nib, FirstView.xib and SecondView.xib for the TabBarWithSegmentControl application.</p>
<p>Step 4: Open the FirstViewController.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> FirstViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
IBOutlet UISegmentedControl <span class="sy0">*</span>segmentControl;<br />
IBOutlet UIView <span class="sy0">*</span>Firstview1;<br />
IBOutlet UIView <span class="sy0">*</span>Secondview2;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>segmentAction<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 FirstView.xib file and open it to the Interface Builder . First drag the Segmented Control from the library and place it to the view window. Select the Segmented control and bring up Connection Inspector and connect Touch Up Inside to the File Owner icon and select segmentAction: , connect File&#8217;s Owner icon to the Segmented Control and select segmentControl. Now drag the View two times from the library and place it to the Interface window. Drag the label from the library and place it to the View window and select the view and bring up Attribute Inspector , and change the background color and text into &#8220;FirstView&#8221;. Do it once more time for another view and change text into &#8220;SecondView&#8221;. Connect File&#8217;s owner icon to the View and select Firstview1. Select File&#8217;s Owner icon to the another view and select Secondview2.</p>
<p>Step 6: Double click the MainWindow.xib file and open it to the Interface Builder. Select the TabBar Controller from the interface window and select the First tab and bring up Attribute Inspector, change the Bar Item Title &#8220;FirstView&#8221;. Do it same for the Second tab and change the tab name &#8220;SecondView&#8221;. Now save the .xib file, close it and go back to the Xcode.</p>
<p>Step 7: Open the FirstView.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;FirstViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> FirstViewController<br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> segmentAction<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 />
UISegmentedControl<span class="sy0">*</span> control <span class="sy0">=</span> sender ;<br />
<span class="kw1">if</span><span class="br0">&#40;</span> <span class="br0">&#91;</span>control selectedSegmentIndex<span class="br0">&#93;</span> <span class="sy0">==</span> 0 <span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span> self.view addSubview<span class="sy0">:</span>Firstview1<span class="br0">&#93;</span> ;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">if</span><span class="br0">&#40;</span> <span class="br0">&#91;</span>control selectedSegmentIndex<span class="br0">&#93;</span> <span class="sy0">==</span> 1 <span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span> self.view addSubview<span class="sy0">:</span>Secondview2<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>viewDidLoad<br />
<span class="br0">&#123;</span><br />
Firstview1.frame <span class="sy0">=</span> CGRectMake<span class="br0">&#40;</span>0, 42, 320, 420<span class="br0">&#41;</span>;<br />
Secondview2.frame <span class="sy0">=</span> CGRectMake<span class="br0">&#40;</span>0, 42, 320, 420<span class="br0">&#41;</span>;<br />
<span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
<span class="co2">// the segment control…</span><br />
<span class="br0">&#91;</span>segmentControl addTarget<span class="sy0">:</span>self action<span class="sy0">:</span><span class="kw1">@selector</span><span class="br0">&#40;</span>segmentAction<span class="sy0">:</span><span class="br0">&#41;</span><br />
forControlEvents<span class="sy0">:</span>UIControlEventValueChanged<span class="br0">&#93;</span>;<br />
segmentControl.selectedSegmentIndex <span class="sy0">=</span> 0 ;<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="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><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">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="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/2011/09/14.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/14-155x300.jpg" alt="" title="1" width="155" height="300" class="alignnone size-medium wp-image-3288" /></a></p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/22.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/22-163x300.jpg" alt="" title="2" width="163" height="300" class="alignnone size-medium wp-image-3289" /></a></p>
<p>You can Download SourceCode from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/09/TabBarWithSegmentControl.zip'>TabBar With Segment Control</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/segment-control-in-tabbar-application-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PhotoCapture Application in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-interface-builder/photocapture-application-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-interface-builder/photocapture-application-in-iphone/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 03:56:22 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Interface Builder]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3278</guid>
		<description><![CDATA[In this application we will see how to capture photo of the view in the application by using button pressed and save the photo in the Photo gallery. So let see how it will worked.
Step 1: Open the Xcode, Create a new project using View Base application. Give the application “PhotoCapture”.
Step 2: Xcode automatically creates [...]]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to capture photo of the view in the application by using button pressed and save the photo in the Photo gallery. 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 “PhotoCapture”.</p>
<p>Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the<br />
directory structure to check out the content of the directory.</p>
<p>Step 3: Expand classes and notice Interface Builder created the RootViewController class for you. Expand Resources and<br />
notice the template generated a separate nib, PhotoCaptureViewController.xib for the PhotoCaptureViewController class.</p>
<p>Step 4: Open the PhotoCaptureViewController.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> PhotoCaptureViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>captureScreen<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 PhotoCaptureViewController.xib file and open it to the Interface Builder. First drag the label from the library andplace it to the view window. Select the label from the view and bring up Attribute Inspector and change the Text into &#8220;Welcome To iPhone&#8221; . Now save the .xib file, close it and go back to the Xcode.</p>
<p>Step 6: In the PhotoCaptureViewController.m file make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;PhotoCaptureViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> PhotoCaptureViewController<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>captureScreen<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>self.view.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="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><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><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 in the Simulator and check Save image in the Photo Gallery.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/13.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/13-160x300.jpg" alt="" title="1" width="160" height="300" class="alignnone size-medium wp-image-3279" /></a></p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/21.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/21-300x225.jpg" alt="" title="2" width="300" height="225" class="alignnone size-medium wp-image-3280" /></a></p>
<p>You can Download SourceCode from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/09/PhotoCapture.zip'>PhotoCapture</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-interface-builder/photocapture-application-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

