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

<channel>
	<title>iPhone Tutorial &#124; iPhone iOS4 iPad SDK Development &#38; Programming Blog &#187; iPhone Programming Tutorials</title>
	<atom:link href="http://www.edumobile.org/iphone/category/iphone-programming-tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.edumobile.org/iphone</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 11:17:27 +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>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>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>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>Password Screen Application in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/password-screen-application-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/password-screen-application-in-iphone/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 11:07:12 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3264</guid>
		<description><![CDATA[This is the Simple PasswordScreen application. In this application we will see how to PassWordScreen display after pressing button. So lets see how it will worked.
Step 1: Open the Xcode, Create a new project using View Base application. Give the application “PasswordScreen”.
Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. [...]]]></description>
			<content:encoded><![CDATA[<p>This is the Simple PasswordScreen application. In this application we will see how to PassWordScreen display after pressing button. So lets see how it will worked.</p>
<p>Step 1: Open the Xcode, Create a new project using View Base application. Give the application “PasswordScreen”.</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, PasswordScreenViewController.xib for the PasswordScreen application.</p>
<p>Step 4: Open the PasswordScreenViewController.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> PasswordScreenViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
IBOutlet UITextField <span class="sy0">*</span>userName;<br />
IBOutlet UITextField <span class="sy0">*</span>password;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>PasswodAlert<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 PasswordScreenViewController.xib file and open it to the interface builder. First drag the two label from the library and place it to the view window, select the label and bring up attribute inspector change the labels name into &#8220;Name&#8221; and &#8220;Details&#8221;. Drag two textfield and one round rect button from the library and place it to the view window. Now connect File&#8217;s Owner icon to the first TextField and select &#8220;userName&#8221; , do it once more for second TextField and select &#8220;password&#8221;. Select the round rect button and bring up Connection Inspector, connect Touch up Inside to the File&#8217;s Owner icon and select &#8220;PasswordAlert&#8221;. Save the .sib file, close it , and go back to the Xcode.</p>
<p>Step 6: Open the PasswordScreenViewController.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;PasswordScreenViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> PasswordScreenViewController<br />
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>PasswordAlert<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 />
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><br />
initWithTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Enter Your Password&quot;</span> message<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;&quot;</span><br />
delegate<span class="sy0">:</span>self cancelButtonTitle<span class="sy0">:</span><span class="kw2">nil</span><br />
otherButtonTitles<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Submit&quot;</span>,<span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>alert addTextFieldWithValue<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;&quot;</span> label<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Enter Password&quot;</span><span class="br0">&#93;</span>;<br />
UITextField <span class="sy0">*</span>textfield <span class="sy0">=</span> <span class="br0">&#91;</span>alert textFieldAtIndex<span class="sy0">:</span>0<span class="br0">&#93;</span>;<br />
textfield.secureTextEntry <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
<span class="br0">&#91;</span>alert show<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="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.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/11.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/11-162x300.jpg" alt="" title="1" width="162" height="300" class="alignnone size-medium wp-image-3266" /></a></p>
<p>You can Download SourceCode from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/09/PasswordScreen.zip'>PasswordScreen</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/password-screen-application-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to select image from Library in iPhone</title>
		<link>http://www.edumobile.org/iphone/miscellaneous/how-to-select-image-from-library-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/miscellaneous/how-to-select-image-from-library-in-iphone/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 10:51:58 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[iPhone Programming Tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3255</guid>
		<description><![CDATA[In this article we will see how to image select from phone gallery and display the same image 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 “SelectImage”.
Step 2: Xcode automatically creates the directory structure and adds essential frameworks [...]]]></description>
			<content:encoded><![CDATA[<p>In this article we will see how to image select from phone gallery and display the same image in the application. 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 “SelectImage”.</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<br />
notice the template generated a separate nib, SelectImage ViewController.xib for the SelectImage application.</p>
<p>Step 4: Open the SelectImageViewController.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">@interface</span> SelectImageViewController <span class="sy0">:</span> UIViewController<br />
&lt; UIImagePickerControllerDelegate , UINavigationControllerDelegate&gt;<br />
<span class="br0">&#123;</span><br />
IBOutlet UIImageView <span class="sy0">*</span>imageSelect;<br />
IBOutlet UIButton <span class="sy0">*</span>libraryButton;<br />
<span class="br0">&#125;</span><br />
<span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic,retain<span class="br0">&#41;</span> UIImageView <span class="sy0">*</span>imageSelect;<br />
<span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic,retain<span class="br0">&#41;</span> UIButton <span class="sy0">*</span>libraryButton;<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>LibraryPicture;<br />
<span class="kw1">@end</span></div>
</div>
<p>Step 5: Double click the SelectImageViewController.xib file and open it to the Interface Builder. Firs drag the ImageView from the libraryand place it to the view window. Connect File&#8217;s Owner icon to the UIImageView and select imageSelect. Now drag the button from thelibrary and place it to the view window, select button and bring up Connection Inspector connect Touch Up Inside to the File&#8217;s Owner iconand select LibraryPicture. Now save the .xib file and go back to the Xcode.</p>
<p>Step 6: Open the SelectImageViewController.m file and change the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;SelectImageViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> SelectImageViewController<br />
<span class="kw1">@synthesize</span> imageSelect;<br />
<span class="kw1">@synthesize</span> libraryButton;<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>imageSelect release<span class="br0">&#93;</span>;<br />
<span class="co2">//[takePictureButton release];</span><br />
<span class="br0">&#91;</span>libraryButton 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="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>LibraryPicture<br />
<span class="br0">&#123;</span><br />
<span class="kw1">if</span><span class="br0">&#40;</span><span class="br0">&#91;</span>UIImagePickerController isSourceTypeAvailable<span class="sy0">:</span><br />
UIImagePickerControllerSourceTypePhotoLibrary<span class="br0">&#93;</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
UIImagePickerController <span class="sy0">*</span>picker<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 />
picker.delegate <span class="sy0">=</span> self;<br />
picker.sourceType <span class="sy0">=</span> UIImagePickerControllerSourceTypePhotoLibrary;<br />
<span class="br0">&#91;</span>self presentModalViewController<span class="sy0">:</span>picker animated<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>picker release<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>imagePickerController<span class="sy0">:</span><span class="br0">&#40;</span>UIImagePickerController <span class="sy0">*</span><span class="br0">&#41;</span>picker<br />
didFinishPickingImage <span class="sy0">:</span> <span class="br0">&#40;</span>UIImage <span class="sy0">*</span><span class="br0">&#41;</span>image<br />
editingInfo<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>editingInfo<br />
<span class="br0">&#123;</span><br />
imageSelect.image <span class="sy0">=</span> image;<br />
<span class="br0">&#91;</span>picker dismissModalViewControllerAnimated<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>imagePickerControllerDidCancel<span class="sy0">:</span><span class="br0">&#40;</span>UIImagePickerController <span class="sy0">*</span><span class="br0">&#41;</span> picker<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>picker dismissModalViewControllerAnimated<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>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/1.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/1-164x300.jpg" alt="" title="1" width="164" height="300" class="alignnone size-medium wp-image-3257" /></a></p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/2.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/09/2-164x300.jpg" alt="" title="2" width="164" height="300" class="alignnone size-medium wp-image-3258" /></a></p>
<p>You can Download SourceCode from <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/09/SelectImage.zip'>SelectImage</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/miscellaneous/how-to-select-image-from-library-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Text Scroll in iPhone</title>
		<link>http://www.edumobile.org/iphone/miscellaneous/text-scroll-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/miscellaneous/text-scroll-in-iphone/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 07:10:33 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[iPhone Interface Builder]]></category>
		<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[Text Scroll in iPhone]]></category>
		<category><![CDATA[TextScroll]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3163</guid>
		<description><![CDATA[In this application we will see how to text file read from the resource and display in the scroll view. So let see how it will worked]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to text file read from the resource and display in the scroll view. So let see how it will worked. My last post you can find out from here <a href="http://www.edumobile.org/iphone/iphone-programming-tutorials/textview-application-in-iphone-2/">TextView </a>.</p>
<p><strong>Step 1:</strong> Open the Xcode, Create a new project using View Base application. Give the application “Text_Scroll”.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3: </strong>In the Text_ScrollViewController.h class , 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></p>
<p><span class="kw1">@interface</span> Text_ScrollViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span></p>
<p>UITextView <span class="sy0">*</span>textData;<br />
UIScrollView <span class="sy0">*</span>textScroll;</p>
<p><span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UITextView <span class="sy0">*</span>textData;<br />
<span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UIScrollView <span class="sy0">*</span>textScroll;</p>
<p><span class="kw1">@end</span></div>
</div>
<p><strong>Step 4 : </strong>Double click the  Text_ScrollViewController.xib file and open it to the Interface Builder. First drag the Navigation Bar from the library and place it to the View window. Select the Navigation Bar and bring up Attribute Inspector, change the Title name into “Text Scroll”. Next drag the Scroll View from the library and place it to the view window. Connect File&#8217;s Owner icon to the view icon and select &#8220;textScroll&#8221;. Now save the .xib file and go back to the Xcode.</p>
<p><strong>Step 5:</strong> Open the Text_ScrollViewController.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;Text_ScrollViewController.h&quot;</span></p>
<p><span class="kw1">@implementation</span> Text_ScrollViewController</p>
<p><span class="kw1">@synthesize</span> textData,textScroll;</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; &nbsp; <span class="co2">// Releases the view if it doesn&#8217;t have a superview.</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="co2">// Release any cached data, images, etc that aren&#8217;t in use.</span><br />
<span class="br0">&#125;</span></p>
<p><span class="co1">#pragma mark &#8211; View lifecycle</span></p>
<p>
<span class="co2">// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.</span><br />
<span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad<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; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>filePath <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span class="kw5">NSBundle</span></a> mainBundle<span class="br0">&#93;</span> pathForResource<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;TextData&quot;</span> ofType<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;txt&quot;</span><span class="br0">&#93;</span>; &nbsp;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>filePath<span class="br0">&#41;</span> <span class="br0">&#123;</span> &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>myText1 <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> stringWithContentsOfFile<span class="sy0">:</span>filePath<span class="br0">&#93;</span>; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>myText1<span class="br0">&#41;</span> <span class="br0">&#123;</span> &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co2">//textView.text= myText; &nbsp;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textData<span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UITextView alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span>CGRectMake<span class="br0">&#40;</span>5,0, 316,350<span class="br0">&#41;</span><span class="br0">&#93;</span>; <span class="co2">//size.height-30 )];</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textData.text <span class="sy0">=</span> myText1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>textData setFont<span class="sy0">:</span><span class="br0">&#91;</span>UIFont systemFontOfSize<span class="sy0">:</span>20<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>textData setBackgroundColor<span class="sy0">:</span><span class="br0">&#91;</span>UIColor clearColor<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>textData setTextColor<span class="sy0">:</span><span class="br0">&#91;</span>UIColor whiteColor<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textData.editable <span class="sy0">=</span> <span class="kw2">NO</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textData.dataDetectorTypes <span class="sy0">=</span> UIDataDetectorTypeNone;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>textScroll addSubview<span class="sy0">:</span>textData<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> &nbsp;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span> &nbsp;<br />
&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; <span class="co2">// Release any retained subviews of the main view.</span><br />
&nbsp; &nbsp; <span class="co2">// e.g. self.myOutlet = nil;</span><br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">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></p>
<p><span class="kw1">@end</span></div>
</div>
<p><strong>step 6:</strong> Now compile and run the application on the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/08/iphone.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/08/iphone.jpg" alt="" title="iphone" width="161" height="300" class="alignnone size-full wp-image-3169" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/08/Text_Scroll.zip'>Text_Scroll</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/miscellaneous/text-scroll-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TextView Application in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/textview-application-in-iphone-2/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/textview-application-in-iphone-2/#comments</comments>
		<pubDate>Sat, 13 Aug 2011 11:36:50 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Interface Builder]]></category>
		<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[TextView Application]]></category>
		<category><![CDATA[TextView application in iPhone]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3155</guid>
		<description><![CDATA[This is the  very simple TextView application. In this application we will see how to create TextView application using Interface Builder. So let see how it will worked. ]]></description>
			<content:encoded><![CDATA[<p>This is the  very simple TextView application. In this application we will see how to create TextView application using Interface Builder. So let see how it will worked. My last post you can find out from here<a href="http://www.edumobile.org/iphone/iphone-programming-tutorials/imagechange-using-button-pressed-in-iphone/"> ImageChange.</a></p>
<p><strong>Step 1:</strong> Open the Xcode, Create a new project using View Base application. Give the application “TextView_iPhone”.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> Double click the TextView_iPhoneViewController.xib file and open it to the Interface Builder. First drag the TextView from the library and place it to the view window. Select the View window and bring up Attribute Inspector and change the Text with &#8220;This is the TextView Application&#8221;. Save the .xib file and go back to the Xcode.</p>
<p><strong>Step 4:</strong> Now compile and run the application on the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/08/12.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/08/12-161x300.jpg" alt="" title="1" width="161" height="300" class="alignnone size-medium wp-image-3160" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here  <a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/08/TextView_iPhone.zip">TextView_iPhone</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/textview-application-in-iphone-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ImageChange using button pressed in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/imagechange-using-button-pressed-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/imagechange-using-button-pressed-in-iphone/#comments</comments>
		<pubDate>Sat, 06 Aug 2011 07:17:21 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[ImageChange using button pressed in iPhone]]></category>
		<category><![CDATA[ImageChange using ButtonPressed]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3141</guid>
		<description><![CDATA[In this example we will see how to ImageChange using button pressed. So let see how it will work in our application. ]]></description>
			<content:encoded><![CDATA[<p>In this example we will see how to ImageChange using button pressed. So let see how it will work in our application. My previous post you can find out from here <a href="http://www.edumobile.org/iphone/iphone-programming-tutorials/keyboard-example-in-iphone/">KeyBoard example </a></p>
<p><strong>Step 1: </strong>Open the Xcode, Create a new project using View Base application. Give the application “ImageChange”.</p>
<p><strong>Step 2: </strong>Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> Open the ImageChangeViewController.h file and make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span></p>
<p><span class="kw1">@interface</span> ImageChangeViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span></p>
<p>UIView <span class="sy0">*</span>View3;<br />
UIImageView <span class="sy0">*</span>View1;<br />
UIImageView <span class="sy0">*</span>View2;</p>
<p><span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> UIView <span class="sy0">*</span>View3;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> UIImageView <span class="sy0">*</span>View1;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> UIImageView <span class="sy0">*</span>View2;</p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>MoveImage<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender;</p>
<p><span class="kw1">@end</span></div>
</div>
<p><strong>Step 4: </strong>Double click the ImageChangeViewController.xib file and open it to the Interface Builder. First drag the UIButton from library and place it to the view window. Select the Button and bring up Connection Inspector and drag Touch Up Inside to the File&#8217;s Owner icon and select MoveImage: action. Now save the .xib file and go back to the Xcode.</p>
<p><strong>Step 5: </strong>In the ImageChangeViewController.m file make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;ImageChangeViewController.h&quot;</span></p>
<p><span class="co1">#define kHeight &nbsp; &nbsp; &nbsp; &nbsp; 320.0</span><br />
<span class="co1">#define kWidth&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 400.0</span><br />
<span class="co1">#define kTransitionDuration &nbsp; &nbsp; 0.75</span><br />
<span class="co1">#define kTopPlacement &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 80.0</span></p>
<p><span class="kw1">@implementation</span> ImageChangeViewController</p>
<p><span class="kw1">@synthesize</span> View3, View1, View2;</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 />
<span class="br0">&#91;</span>View1 release<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>View2 release<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>View3 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></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 />
<span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</span>;</p>
<p><span class="br0">&#125;</span></p>
<p><span class="co1">#pragma mark &#8211; View lifecycle</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;</p>
<p>self.title <span class="sy0">=</span> NSLocalizedString<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;TransitionsTitle&quot;</span>, <span class="co3">@</span><span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>;</p>
<p>CGRect frame <span class="sy0">=</span> CGRectMake<span class="br0">&#40;</span>round<span class="br0">&#40;</span><span class="br0">&#40;</span>self.view.bounds.size.width <span class="sy0">-</span> kWidth<span class="br0">&#41;</span> <span class="sy0">/</span> 2.0<span class="br0">&#41;</span>,<br />
kTopPlacement, kWidth, kHeight<span class="br0">&#41;</span>;<br />
self.View3 <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UIView alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span>frame<span class="br0">&#93;</span> autorelease<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.view addSubview<span class="sy0">:</span>self.View3<span class="br0">&#93;</span>;</p>
<p>frame <span class="sy0">=</span> CGRectMake<span class="br0">&#40;</span>0.0, 0.0, kWidth, kHeight<span class="br0">&#41;</span>;<br />
self.View1 <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UIImageView alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span>frame<span class="br0">&#93;</span> autorelease<span class="br0">&#93;</span>;<br />
self.View1.image <span class="sy0">=</span> <span class="br0">&#91;</span>UIImage imageNamed<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;1.png&quot;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.View3 addSubview<span class="sy0">:</span>self.View1<span class="br0">&#93;</span>;</p>
<p>CGRect imageFrame <span class="sy0">=</span> CGRectMake<span class="br0">&#40;</span>0.0, 0.0, kWidth, kHeight<span class="br0">&#41;</span>;<br />
self.View2 <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UIImageView alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span>imageFrame<span class="br0">&#93;</span> autorelease<span class="br0">&#93;</span>;<br />
self.View2.image <span class="sy0">=</span> <span class="br0">&#91;</span>UIImage imageNamed<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;2.png&quot;</span><span class="br0">&#93;</span>;</p>
<p><span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>MoveImage<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>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>kTransitionDuration<span class="br0">&#93;</span>;</p>
<p><span class="br0">&#91;</span>UIView setAnimationTransition<span class="sy0">:</span><span class="br0">&#40;</span><span class="br0">&#91;</span>self.View1 superview<span class="br0">&#93;</span> ?<br />
UIViewAnimationTransitionCurlUp <span class="sy0">:</span> UIViewAnimationTransitionCurlDown<span class="br0">&#41;</span><br />
forView<span class="sy0">:</span>self.View3 cache<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
<span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>self.View2 superview<span class="br0">&#93;</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>self.View2 removeFromSuperview<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.View3 addSubview<span class="sy0">:</span>self.View1<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>self.View1 removeFromSuperview<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>self.View3 addSubview<span class="sy0">:</span>self.View2<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="br0">&#91;</span>UIView commitAnimations<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>viewDidUnload<br />
<span class="br0">&#123;</span><br />
<span class="br0">&#91;</span>super viewDidUnload<span class="br0">&#93;</span>;</p>
<p>self.View3 <span class="sy0">=</span> <span class="kw2">nil</span>;<br />
self.View2 <span class="sy0">=</span> <span class="kw2">nil</span>;<br />
self.View1 <span class="sy0">=</span> <span class="kw2">nil</span>;</p>
<p><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 />
<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></p>
<p><span class="kw1">@end</span></div>
</div>
<p><strong>Step 6:</strong> Now compile and run the application in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/08/1.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/08/1-164x300.jpg" alt="" title="1" width="164" height="300" class="alignnone size-medium wp-image-3144" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/08/ImageChange1.zip'>ImageChange</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/imagechange-using-button-pressed-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KeyBoard example in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/keyboard-example-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/keyboard-example-in-iphone/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 07:49:58 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Beginner Tutorials]]></category>
		<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[KeyBoard Example]]></category>
		<category><![CDATA[KeyBoard example in iPhone]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3131</guid>
		<description><![CDATA[This is the simple KeyBoard example. In this example we will see how to keyBoard implement the application and hide from the application using button pressed. So let see how it will worked.]]></description>
			<content:encoded><![CDATA[<p>This is the simple KeyBoard example. In this example we will see how to keyBoard implement the application and hide from the application using button pressed. So let see how it will worked. My last post you can find out from here  <a href="http://www.edumobile.org/iphone/iphone-programming-tutorials/move-image-using-touch-function-in-iphone/">MoveImage</a></p>
<p><strong>Step 1: </strong>Open the Xcode, Create a new project using View Base application. Give the application “KeyBoard_Example”.</p>
<p><strong>Step 2: </strong>Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3: </strong> Open the KeyBoard_ExampleViewController.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></p>
<p><span class="kw1">@interface</span> KeyBoard_ExampleViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span></p>
<p>IBOutlet UITextField <span class="sy0">*</span>textField;</p>
<p><span class="br0">&#125;</span></p>
<p><span class="kw1">@end</span></div>
</div>
<p><strong>Step 4:</strong> Double click the KeyBoard_ExampleViewController.xib file and open it to the Interface Builder. First drag the label and place it to the view window, change the label name into &#8220;Name&#8221; and drag the TextField from the library and place it to the view window. Select the TextField and bring up Attributes Inspector and the placeholder into&#8221;Enter your name&#8221; and select the TextFiled once again and bring up Connection Inspector and connect delegate to the File&#8217;s Owner icon. Now, save the .xib file and go back to the Xcode.</p>
<p><strong>Step 5: </strong>In the KeyBoard_ExampleViewController.m file make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &quot;KeyBoard_ExampleViewController.h&quot;</span><br />
<span class="kw1">@implementation</span> KeyBoard_ExampleViewController</p>
<p><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></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 />
<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>;</p>
<p><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></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></p>
<p><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></p>
<p><span class="kw1">@end</span></div>
</div>
<p><strong>Step 6:</strong> Now compile and the run the application on the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/07/11.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/07/11-157x300.jpg" alt="" title="1" width="157" height="300" class="alignnone size-medium wp-image-3136" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here   <a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/07/KeyBoard_Example1.zip">KeyBoard_Example</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/keyboard-example-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Move Image using Touch Function in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/move-image-using-touch-function-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/move-image-using-touch-function-in-iphone/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 10:20:34 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Beginner Tutorials]]></category>
		<category><![CDATA[iPhone Interface Builder]]></category>
		<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[Move Image]]></category>
		<category><![CDATA[Move Image using Touch Function in iPhone]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3123</guid>
		<description><![CDATA[This is the very simple application. In this application we will see how to image move using touch. So let see how it will work. ]]></description>
			<content:encoded><![CDATA[<p>This is the very simple application. In this application we will see how to image move using touch. So let see how it will work. My previous post you can find out from here <a href="http://www.edumobile.org/iphone/iphone-programming-tutorials/imageview-display-after-pressing-button-in-iphone/">ImageView Display</a></p>
<p><strong>Step 1 : </strong>Open the Xcode, Create a new project using View Base application. Give the application “Touch_Image”.</p>
<p><strong>Step 2: </strong>Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3: </strong>We need add also two resource in the project.</p>
<p><strong>Step 4: </strong>In the Touch_ImageViewController.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></p>
<p><span class="kw1">@interface</span> Touch_ImageViewController <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="kw1">@end</span></div>
</div>
<p><strong>Step 5:</strong> Double click the Touch_ImageViewController.xib file and open it to the interface builder. First select the view and bring up Attribute Inspector and change the background color. Drag the label from the library and place it to the view window. Select the label and bring up Attributes Inspector and the text to &#8220;Touch Anywhere&#8221; . Now drag the ImageView from the library and place it to the view window. Select the Image View from the view and bring up Attribute Inspector and select the litchi-big.png image. Connect File&#8217;s Owner icon to the image view and select image. Now save the .xib file, save it and go back to the Xcode.</p>
<p><strong>Step 6: </strong>Open the Touch_ImageViewController.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;Touch_ImageViewController.h&quot;</span></p>
<p><span class="kw1">@implementation</span> Touch_ImageViewController</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 />
<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>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></p>
<p>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>touch.view<span class="br0">&#93;</span>;<br />
image.center <span class="sy0">=</span> touchLocation;<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></p>
<p><span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</span>;</p>
<p><span class="br0">&#125;</span></p>
<p><span class="co1">#pragma mark &#8211; View lifecycle</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 />
<span class="br0">&#91;</span>super viewDidUnload<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">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></p>
<p><span class="kw1">@end</span></div>
</div>
<p><strong>Step 7: </strong>Now compile and run the application on the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/07/1.jpg"><img class="alignnone size-medium wp-image-3125" title="1" src="http://www.edumobile.org/iphone/wp-content/uploads/2011/07/1-159x300.jpg" alt="" width="159" height="300" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/07/Touch_Image.zip'>Touch_Image</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/move-image-using-touch-function-in-iphone/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ImageView display after pressing Button in iPhone</title>
		<link>http://www.edumobile.org/iphone/iphone-programming-tutorials/imageview-display-after-pressing-button-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/iphone-programming-tutorials/imageview-display-after-pressing-button-in-iphone/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 07:42:46 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPhone Beginner Tutorials]]></category>
		<category><![CDATA[iPhone Interface Builder]]></category>
		<category><![CDATA[iPhone Programming Tutorials]]></category>
		<category><![CDATA[ImageView display]]></category>
		<category><![CDATA[ImageView display after pressing Button in iPhone]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=3117</guid>
		<description><![CDATA[In this application we will see how to image display after pressing button. So let see how it will worked. ]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to image display after pressing button. So let see how it will worked. Another Button Pressed example you can find out from here <a href="http://www.edumobile.org/iphone/iphone-programming-tutorials/how-to-change-background-color-after-pressing-button-in-iphone/">Change BackgroundColor</a></p>
<p><strong>Step 1:</strong> Open the Xcode, Create a new project using View Base application. Give the application “Button_Fun”.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> We need to add two UIViewController class in the project. So select the project -&gt; New File -&gt; Cocoa Touch -&gt;ViewController class and give the class name ”ImageView” and “SecondImageView”.</p>
<p><strong>Step 4:</strong> We need add also two resource in the project.</p>
<p><strong>Step 5: </strong>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">@interface</span> Button_FunViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span></p>
<p>IBOutlet UIButton<span class="sy0">*</span>button;<br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>ButtonPressed<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender;<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>SecondButtonPressed<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender;</p>
<p><span class="kw1">@end</span></div>
</div>
<p><strong>Step 6:</strong> Double click the Button_FunViewController.xib file and open it to the Interface Builder. First drag the two Round Rect button from the library and place it to the view window and give the name of the buttons &#8220;FirstButton&#8221; and &#8220;SecondButton&#8221;. Select the FirstButton from the view window and bring up Connection Inspector and connect Touch Up Inside to the Files owner icon and select ButtonPressed: method. Select the another button &#8220;SecondButton&#8221; and bring up Connection Inspector and connect Touch Up Inside to the Files owner icon and select SecondButtonPressed: method.Now save the .xib file, close it and go back to the Xcode.</p>
<p><strong>Step 7:</strong> Double click the ImageView.xib file and open it to the Interface Builder. Drag the image view from the library and place it to the view window. Select the ImageView from the view and bring up Attribute Inspector and select the &#8220;cutest-baby-5.jpg&#8221;. Now save the .xib file , close it and go back to the Xcode.</p>
<p><strong>Step 8: </strong>Double click the SeconImageView.xib file and open it to the Interface Builder. Drag the image view from the library and place it to the view window. Select the ImageView from the view and bring up Attribute Inspector and select the &#8220;cutest-baby-6.jpg&#8221;. Now save the .xib file , close it and go back to the Xcode.</p>
<p><strong>Step 9:</strong> In the Button_FunViewController.m file make the following changes:</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;ImageView.h&quot;</span><br />
<span class="co1">#import &quot;SecondImageview.h&quot;</span></p>
<p><span class="kw1">@implementation</span> Button_FunViewController</p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>ButtonPressed<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 />
ImageView <span class="sy0">*</span>imageView <span class="sy0">=</span><span class="br0">&#91;</span><span class="br0">&#91;</span>ImageView alloc<span class="br0">&#93;</span><br />
initWithNibName<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;ImageView&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>imageView.view<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>SecondButtonPressed<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 />
SecondImageview <span class="sy0">*</span>secondImageView <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>SecondImageview alloc<span class="br0">&#93;</span><br />
initWithNibName<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;SecondImageview&quot;</span><br />
bundle<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;</p>
<p><span class="br0">&#91;</span>self.view addSubview<span class="sy0">:</span>secondImageView.view<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>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></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></p>
<p><span class="br0">&#91;</span>super didReceiveMemoryWarning<span class="br0">&#93;</span>;</p>
<p><span class="br0">&#125;</span></p>
<p><span class="co1">#pragma mark &#8211; View lifecycle</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 />
<span class="br0">&#91;</span>super viewDidUnload<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">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></p>
<p><span class="kw1">@end</span></div>
</div>
<p><strong>Step 10:</strong> Now compile and run the application on the Simulator.<br />
<a href="http://www.edumobile.org/iphone/wp-content/uploads/2011/07/1-39.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2011/07/1-39-162x300.jpg" alt="" title="1-39" width="162" height="300" class="alignnone size-medium wp-image-3119" /></a></p>
<p>You can <strong>Download SourceCode </strong>from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2011/07/Button_Fun.zip'>Button_Fun</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/iphone-programming-tutorials/imageview-display-after-pressing-button-in-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

