<?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; iPad Development</title>
	<atom:link href="http://www.edumobile.org/iphone/category/ipad-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.edumobile.org/iphone</link>
	<description></description>
	<lastBuildDate>Wed, 25 Jan 2012 09:42:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Double Component Picker in iPad</title>
		<link>http://www.edumobile.org/iphone/ipad-development/double-component-picker-in-ipad/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/double-component-picker-in-ipad/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 07:12:23 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[Double Component Picker]]></category>
		<category><![CDATA[Double Component picker in iPad]]></category>
		<category><![CDATA[iPad tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2560</guid>
		<description><![CDATA[This is the Double Component Picker example. In this example we will see how to worked it in the iPad.]]></description>
			<content:encoded><![CDATA[<p>This is the Double Component Picker example. In this example we will see how to worked it in the iPad.</p>
<p><strong>Step 1:</strong> Create a View base application using template. Give the application name  ”DoubleComponentPicker_ipad”.</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>Expand classes and notice Interface Builder created the DoubleComponentPicker_ipad class for you. Expand Resources and notice the template generated a separate nib, DoubleComponentPicker_ipadViewController.xib, for the “DoubleComponentPicker_ipad”.</p>
<p><strong>Step 4 :</strong> In the DoubleComponentPicker_ipadViewController.h file , we have added DataSource and delegate protocol. Create an instance of UIPickerView class and add one IBAction method. So 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">#define kFillingComponent &nbsp;0</span><br />
<span class="co1">#define kBreadComponent &nbsp;1</span></p>
<p><span class="kw1">@interface</span> DoubleComponentPicker_ipadViewController <span class="sy0">:</span> UIViewController &lt;UIPickerViewDelegate, UIPickerViewDataSource&gt;<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; IBOutlet UIPickerView <span class="sy0">*</span>doublePicker;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>fillingTypes;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>breadTypes;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic,retain<span class="br0">&#41;</span> &nbsp;UIPickerView <span class="sy0">*</span>doublePicker;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic,retain<span class="br0">&#41;</span> &nbsp;<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>fillingTypes;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic,retain<span class="br0">&#41;</span> &nbsp;<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>breadTypes;</p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>buttonPressed;</div>
</div>
<p><strong>Step 5: </strong>Double click the DoubleComponentPicker_ipadViewController.xib file and open it to the Interface Builder. First drag the Picker view from the library and place it to the view window and drag round rect button from the library and place it to the view window. Select the picker from the view window and bring up connection inspector and drag from the datasource to the file’s owner icon, do the same thing for delegate protocol. Select the round rect button and bring up Connection Inspector and drag from the Touch Up Inside to the File’s Owner icon and select buttonPressed: action. Now save the DoubleComponentPicker_ipadViewController.xib file, close it and go back to the Xcode.</p>
<p><strong>Step 6: </strong>Open the DoubleComponentPicker_ipadViewController.m file and make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>buttonPressed<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NSInteger breadRow <span class="sy0">=</span> <span class="br0">&#91;</span>doublePicker selectedRowInComponent<span class="sy0">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; kBreadComponent<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; NSInteger fillingRow <span class="sy0">=</span> <span class="br0">&#91;</span>doublePicker selectedRowInComponent<span class="sy0">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; kFillingComponent<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>bread <span class="sy0">=</span> <span class="br0">&#91;</span>breadTypes objectAtIndex<span class="sy0">:</span>breadRow<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>filling <span class="sy0">=</span> <span class="br0">&#91;</span>fillingTypes objectAtIndex<span class="sy0">:</span>fillingRow<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>message <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> alloc<span class="br0">&#93;</span> initWithFormat<span class="sy0">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co3">@</span><span class="st0">&quot;Your %@ on %@ bread will be right up.&quot;</span>,filling, bread<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; 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;Thank you for your order&quot;</span> message<span class="sy0">:</span>message delegate<span class="sy0">:</span><span class="kw2">nil</span> cancelButtonTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Great!&quot;</span> otherButtonTitles<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>alert show<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>alert release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>message release<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</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 <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>breadArray <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> alloc<span class="br0">&#93;</span> initWithObjects<span class="sy0">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co3">@</span><span class="st0">&quot;White&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Whole Wheat&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Rye&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Sourdough&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Seven Grain&quot;</span>, <span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.breadTypes <span class="sy0">=</span> breadArray;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>breadArray release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>fillingArray <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> alloc<span class="br0">&#93;</span> initWithObjects<span class="sy0">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co3">@</span><span class="st0">&quot;Turkey&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Peanut Butter&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Tuna Salad&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Chicken Salad&quot;</span>,<span class="co3">@</span><span class="st0">&quot;Roast Beef&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co3">@</span><span class="st0">&quot;Vegemite&quot;</span>,<span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.fillingTypes <span class="sy0">=</span> fillingArray;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>fillingArray release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>numberOfComponentsInPickerView<span class="sy0">:</span><span class="br0">&#40;</span>UIPickerView <span class="sy0">*</span><span class="br0">&#41;</span>pickerView<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">2</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>pickerView<span class="sy0">:</span><span class="br0">&#40;</span>UIPickerView <span class="sy0">*</span><span class="br0">&#41;</span>pickerView<br />
numberOfRowsInComponent<span class="sy0">:</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>component<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>component <span class="sy0">==</span> kBreadComponent<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span><span class="br0">&#91;</span>self.breadTypes count<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span><span class="br0">&#91;</span>self.fillingTypes count<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>pickerView<span class="sy0">:</span><span class="br0">&#40;</span>UIPickerView <span class="sy0">*</span><span class="br0">&#41;</span>pickerView<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; titleForRow<span class="sy0">:</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>row<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;forComponent<span class="sy0">:</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>component <br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>component <span class="sy0">==</span> kBreadComponent<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="br0">&#91;</span>self. breadTypes objectAtIndex<span class="sy0">:</span>row<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="br0">&#91;</span>self.fillingTypes objectAtIndex<span class="sy0">:</span>row<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 7</strong>: Its all done, now compile and run the application in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/08/1-11.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2010/08/1-11-238x300.jpg" alt="" title="1-(1)" width="238" height="300" class="alignnone size-medium wp-image-2561" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2010/08/DoubleComponentPicker_ipad.zip'>DoubleComponentPicker_ipad</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/double-component-picker-in-ipad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SingleComponent Picker in iPad</title>
		<link>http://www.edumobile.org/iphone/ipad-development/singlecomponent-picker-in-ipad/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/singlecomponent-picker-in-ipad/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 07:16:13 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[iPad tutorials]]></category>
		<category><![CDATA[Single Component Picker]]></category>
		<category><![CDATA[SingleComponent Picker in iPad]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2550</guid>
		<description><![CDATA[This is the Single Component Picker application. In this application we will see how to add Single Component in iPad.]]></description>
			<content:encoded><![CDATA[<p>This is the Single Component Picker application. In this application we will see how to add Single Component in iPad.</p>
<p><strong>Step 1:</strong> Create a View base application using template. Give the application name  &#8221;SingleComponent_iPad&#8221;.</p>
<p><strong>Step 2: </strong>Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> Expand classes and notice Interface Builder created the SingleComponent_iPadViewController class for you. Expand Resources and notice the template generated a separate nib, SingleComponent_iPadViewController.xib, for the “SingleComponent_iPad”.</p>
<p><strong>Step 4:</strong> In the SingleComponent_iPadViewController.h file , we have added DataSource and delegate protocol. Create an instance of UIPickerView class and add one IBAction method. So 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> SingleComponent_iPadViewController <span class="sy0">:</span> UIViewController<br />
&lt;UIPickerViewDataSource , UIPickerViewDelegate&gt;<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; IBOutlet UIPickerView <span class="sy0">*</span>singlePickerComponent;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>pickerData;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic , retain<span class="br0">&#41;</span> UIPickerView <span class="sy0">*</span>singlePickerComponent;<br />
<span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic , retain<span class="br0">&#41;</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>pickerData;</p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>buttonPressed;</div>
</div>
<p><strong>Step 5:</strong> Double click the SingleComponent_iPadViewController.xib file, open it to the Interface Builder. First drag the Picker view from the library and place it to the view window and drag round rect button from the library and place it to the view window. Select the picker from the view window and bring up connection inspector and drag from the datasource to the file&#8217;s owner icon, do the same thing for delegate protocol. Select the round rect button and bring up Connection Inspector and drag from the Touch Up Inside to the File&#8217;s Owner icon and select buttonPressed: action. Now save the SingleComponent_iPadViewController.xib file, close it and go back to the Xcode.</p>
<p><strong>Step 6: </strong>Open the SingleComponent_iPadViewController.m file and make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>buttonPressed<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NSInteger row <span class="sy0">=</span> <span class="br0">&#91;</span>singlePickerComponent selectedRowInComponent<span class="sy0">:</span>0<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>selected <span class="sy0">=</span> <span class="br0">&#91;</span>pickerData objectAtIndex<span class="sy0">:</span>row<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>title <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> alloc<span class="br0">&#93;</span> initWithFormat<span class="sy0">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co3">@</span><span class="st0">&quot;you selected %@!&quot;</span>, selected<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; 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>title<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;message <span class="sy0">:</span> <span class="co3">@</span><span class="st0">&quot;Thank you for choosing.&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;delegate<span class="sy0">:</span><span class="kw2">nil</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cancelButtonTitle <span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;You are Welcome&quot;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;otherButtonTitles <span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>alert show<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>alert release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>title release<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</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 <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> <span class="sy0">*</span>array <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/"><span class="kw5">NSArray</span></a> alloc<span class="br0">&#93;</span> initWithObjects<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;SunDay&quot;</span>,<span class="co3">@</span><span class="st0">&quot;MonDay&quot;</span>,<span class="co3">@</span><span class="st0">&quot;TuesDay&quot;</span>,<span class="co3">@</span><span class="st0">&quot;WednesDay&quot;</span>,<span class="co3">@</span><span class="st0">&quot;ThusDay&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co3">@</span><span class="st0">&quot;FriDay&quot;</span>,<span class="co3">@</span><span class="st0">&quot;SaturDay&quot;</span>,<span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.pickerData <span class="sy0">=</span> array;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>array release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>numberOfComponentsInPickerView<span class="sy0">:</span><span class="br0">&#40;</span>UIPickerView <span class="sy0">*</span><span class="br0">&#41;</span>pickerView<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">1</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>pickerView<span class="sy0">:</span><span class="br0">&#40;</span>UIPickerView <span class="sy0">*</span><span class="br0">&#41;</span>pickerView<br />
numberOfRowsInComponent<span class="sy0">:</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>component<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="br0">&#91;</span>pickerData count<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>pickerView<span class="sy0">:</span><span class="br0">&#40;</span>UIPickerView <span class="sy0">*</span><span class="br0">&#41;</span>pickerView<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; titleForRow<span class="sy0">:</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>row<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;forComponent<span class="sy0">:</span><span class="br0">&#40;</span>NSInteger<span class="br0">&#41;</span>component <br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span><span class="br0">&#91;</span>pickerData objectAtIndex<span class="sy0">:</span>row<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 7: </strong>Now Compile and run the application in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/08/1-1.jpg"><img class="alignnone size-medium wp-image-2551" title="1-(1)" src="http://www.edumobile.org/iphone/wp-content/uploads/2010/08/1-1-238x300.jpg" alt="" width="238" height="300" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/08/SingleComponent_iPad.zip">SingleComponent_iPad</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/singlecomponent-picker-in-ipad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display Splash Screen in iPad</title>
		<link>http://www.edumobile.org/iphone/ipad-development/display-splash-screen-in-ipad/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/display-splash-screen-in-ipad/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 07:33:44 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[Display Splash Screen]]></category>
		<category><![CDATA[Display Splash Screen in iPad]]></category>
		<category><![CDATA[iPad tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2543</guid>
		<description><![CDATA[In this application we will see how to display Splash Screen in iPad.]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to display Splash Screen in iPad.</p>
<p><strong>Step 1: </strong>Create a View base application using template. Give the application name “DisplaySplash_iPad”.</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> Expand classes and notice Interface Builder created the DisplaySplash_iPadViewController class for you. Expand Resources and notice the template generated a separate nib, DisplaySplash_iPadViewController.xib, for the “DisplaySplash_iPad”.</p>
<p><strong>Step 4: </strong>We need to add one resource in the resource folder for display splash.</p>
<p><strong>Step 5: </strong>In the DisplaySplash_iPad.h file, we have created instance of UIView class and two methods. So make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span></p>
<p><span class="kw1">@interface</span> DisplaySplash_iPadViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; IBOutlet UIView <span class="sy0">*</span>displaySplashScreen;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>displayScreen;<br />
<span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>removeScreen;</div>
</div>
<p><strong>Step 6: </strong>Double click the DisplaySplash_iPadViewController.xib file and open it to the Interface Builder. Drag the view from the library and place it to the Main Window. Open the second view icon from the MainWindow,drag the image view from the library and place it to the view window,select the view and bring up Attribute Inspector select the image “themes.png”. Select the File’s Owner icon from the MainWindow and bring up Connection Inspector, drag from the displayScreen to the last view icon and connect File’s Owner icon to the view. Now save it , close it and go back to the Xcode.</p>
<p><strong>Step 7: </strong>Open the DisplaySplash_iPad.m file and make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>displayScreen<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; UIViewController <span class="sy0">*</span>displayViewController<span class="sy0">=</span><span class="br0">&#91;</span><span class="br0">&#91;</span>UIViewController alloc<span class="br0">&#93;</span> init<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; displayViewController.view <span class="sy0">=</span> displaySplashScreen;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self presentModalViewController<span class="sy0">:</span>displayViewController animated<span class="sy0">:</span><span class="kw2">NO</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#91;</span>self performSelector<span class="sy0">:</span><span class="kw1">@selector</span><span class="br0">&#40;</span>removeScreen<span class="br0">&#41;</span> withObject<span class="sy0">:</span><span class="kw2">nil</span> afterDelay<span class="sy0">:</span>6.0<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>removeScreen<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span><span class="br0">&#91;</span>self modalViewController<span class="br0">&#93;</span> dismissModalViewControllerAnimated<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 8 :</strong> Now compile and run the application in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/08/1-71.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2010/08/1-71-232x300.jpg" alt="" title="1-7" width="232" height="300" class="alignnone size-medium wp-image-2547" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2010/08/DisplaySplash_iPad.zip'>DisplaySplash_iPad</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/display-splash-screen-in-ipad/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Change View in iPad</title>
		<link>http://www.edumobile.org/iphone/ipad-development/change-view-in-ipad/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/change-view-in-ipad/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 06:39:41 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[Change View]]></category>
		<category><![CDATA[Change View in iPad]]></category>
		<category><![CDATA[iPad tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2530</guid>
		<description><![CDATA[In this application we will see how to change view in iPad.]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to change view in iPad.</p>
<p><strong>Step 1:</strong> Create a Window base application using template. Give the application name “Windowbase_iPad”.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3: </strong>xpand classes and notice Interface Builder created the Windowbase_iPadAppDelegate class for you. Expand Resources and notice the template generated a separate nib, MainWindow.xib, for the “Windowbase_iPad”.</p>
<p><strong>Step 4:</strong> We need to add two images in the resource folder. Give the name of the resources &#8220;1-1.png&#8221;,&#8221;2-1.png&#8221;.</p>
<p><strong>Step 5:</strong> We have added QuartzCore.framework, select Frameworks -&gt; add -&gt; Existing frameworks -&gt; selectQuartzCore.framework.</p>
<p><strong>Step 6: </strong>In the Windowbase_iPadAppDelegate.h file, we have added instances of UIView and UIImageView class, and create one IBAction method. So make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span></p>
<p><span class="kw1">@interface</span> Windowbase_iPadAppDelegate <span class="sy0">:</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span class="kw5">NSObject</span></a> &lt;UIApplicationDelegate&gt; <span class="br0">&#123;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIWindow <span class="sy0">*</span>window;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIView &nbsp;<span class="sy0">*</span>subView;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIImageView <span class="sy0">*</span>view1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIImageView <span class="sy0">*</span>view2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">BOOL</span> change;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UIWindow <span class="sy0">*</span>window;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UIView &nbsp;<span class="sy0">*</span>subView;</p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>ChangeView<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender;</div>
</div>
<p><strong>Step 7:</strong> Double click your MainWindow.xib file open it to the Interface Builder. Open the the window and drag view from the library and place it to the window. Next drag Toolbar from the library and place it buttom of the view window. Now select WindowbaseiPadAppDelegate from the mainwindow (See figure 1), and bring up connection inspector. Select from subView to the view, and ChangeView to the BarButtonItem. Now save your .xib file and go back to the Xcode.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/08/1-72.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2010/08/1-72-300x241.jpg" alt="" title="1-7" width="300" height="241" class="alignnone size-medium wp-image-2615" /></a></p>
<p><strong>Figure 1:</strong> MainWindow.xib </p>
<p><strong>Step 8: </strong>Open the Windowbase_iPadAppDelegate.m file and make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>application<span class="sy0">:</span><span class="br0">&#40;</span>UIApplication <span class="sy0">*</span><span class="br0">&#41;</span>application didFinishLaunchingWithOptions<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span class="kw5">NSDictionary</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>launchOptions <span class="br0">&#123;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; UIImage <span class="sy0">*</span>image1 <span class="sy0">=</span> <span class="br0">&#91;</span>UIImage imageWithContentsOfFile<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;1-1.png&quot;</span> ofType<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; view1 <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIImageView alloc<span class="br0">&#93;</span> initWithImage<span class="sy0">:</span>image1<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; UIImage <span class="sy0">*</span>image2 <span class="sy0">=</span> <span class="br0">&#91;</span>UIImage imageWithContentsOfFile<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;2-1.png&quot;</span> ofType<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; view2 <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>UIImageView alloc<span class="br0">&#93;</span> initWithImage<span class="sy0">:</span>image2<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; view2.hidden <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>subView addSubview<span class="sy0">:</span>view1<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>subView addSubview<span class="sy0">:</span>view2<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; change <span class="sy0">=</span> <span class="kw2">NO</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>window makeKeyAndVisible<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">YES</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>performTransition<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; CATransition <span class="sy0">*</span>transition <span class="sy0">=</span> <span class="br0">&#91;</span>CATransition animation<span class="br0">&#93;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; transition.duration <span class="sy0">=</span> <span class="nu0">0.75</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; transition.timingFunction <span class="sy0">=</span> <span class="br0">&#91;</span>CAMediaTimingFunction functionWithName<span class="sy0">:</span>kCAMediaTimingFunctionEaseInEaseOut<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>types<span class="br0">&#91;</span>4<span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span>kCATransitionMoveIn, kCATransitionPush, kCATransitionReveal, kCATransitionFade<span class="br0">&#125;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> <span class="sy0">*</span>subtypes<span class="br0">&#91;</span>4<span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span>kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom<span class="br0">&#125;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> rnd <span class="sy0">=</span> random<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">%</span> <span class="nu0">4</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; transition.type <span class="sy0">=</span> types<span class="br0">&#91;</span>rnd<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>rnd &lt; 3<span class="br0">&#41;</span> &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; transition.subtype <span class="sy0">=</span> subtypes<span class="br0">&#91;</span>random<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">%</span> 4<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; change <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; transition.delegate <span class="sy0">=</span> self;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>subView.layer addAnimation<span class="sy0">:</span>transition forKey<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; view1.hidden <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; view2.hidden <span class="sy0">=</span> <span class="kw2">NO</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; UIImageView <span class="sy0">*</span>tmp <span class="sy0">=</span> view2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; view2 <span class="sy0">=</span> view1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; view1 <span class="sy0">=</span> tmp;<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>animationDidStop<span class="sy0">:</span><span class="br0">&#40;</span>CAAnimation <span class="sy0">*</span><span class="br0">&#41;</span>theAnimation finished<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>flag<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; change <span class="sy0">=</span> <span class="kw2">NO</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>ChangeView<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 />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><span class="sy0">!</span>change<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self performTransition<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 9:</strong> Now compile and run the application in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/08/1-7.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2010/08/1-7-230x300.jpg" alt="" title="1-7" width="230" height="300" class="alignnone size-medium wp-image-2535" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2010/08/Windowbase_iPad.zip'>Windowbase_iPad</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/change-view-in-ipad/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mail Send from iPad</title>
		<link>http://www.edumobile.org/iphone/ipad-development/mail-send-from-ipad/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/mail-send-from-ipad/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 07:07:45 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[iPad tutorials]]></category>
		<category><![CDATA[Mail Send]]></category>
		<category><![CDATA[Mail Send from iPad]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2504</guid>
		<description><![CDATA[This is the very simple application. In this application we will see how to mail send from the iPad.]]></description>
			<content:encoded><![CDATA[<p>This is the very simple application. In this application we will see how to mail send from the iPad.</p>
<p><strong>Step 1:</strong> Create a View base application using template. Give the application name “MailComposer”.</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> Expand classes and notice Interface Builder created the MailComposerViewController class for you. Expand Resources and notice the template generated a separate nib, MailComposerViewController.xib, for the “MailComposer”.</p>
<p><strong>Step 4:</strong> We need to add MessageUI Framework. Select Frameworks folder -&gt;Add -&gt; Existing Framework -&gt; Add MessageUI Framework.</p>
<p><strong>Step 5: </strong>In the MailComposerViewController.h file , we have import MessageUI framework. Create an instance of UIButton class and add one buttonPressed method. So make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span><br />
<span class="co1">#import &lt;MessageUI/MessageUI.h&gt;</span></p>
<p><span class="kw1">@interface</span> MailComposerViewController <span class="sy0">:</span> UIViewController <br />
&lt;MFMailComposeViewControllerDelegate&gt;<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; IBOutlet UIButton <span class="sy0">*</span>button;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>buttonPressed;</div>
</div>
<p><strong>Step 6:</strong> Double click MailComposerViewController.xib file and open it to the Interface Builder. First drag the Round Rect button from the library and place it to the view window. Connect File&#8217;s Owner icon to the View icon and select view. Drag File&#8217;s Owner icon to the round Rect button and select button and select the Round Rect button and bring up Connection Inspector next drag Touch Up Inside to the File&#8217;s Owner icon and select buttonPressed: action. Now save the MailComposerViewController.xib file, close it and go back to the Xcode.</p>
<p><strong>Step 7:</strong> Open the MailComposerViewController.m file and make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>MFMailComposeViewController canSendMail<span class="br0">&#93;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; button.enabled <span class="sy0">=</span> <span class="kw2">YES</span>;<br />
<span class="br0">&#125;</span></p>
<p>
<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>buttonPressed <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; MFMailComposeViewController <span class="sy0">*</span>mailController <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>MFMailComposeViewController alloc<span class="br0">&#93;</span> init<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; mailController.mailComposeDelegate <span class="sy0">=</span> self;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mailController setSubject<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Hello World&quot;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mailController setMessageBody<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;This is the MailSend Application&#8230;.&quot;</span> isHTML<span class="sy0">:</span><span class="kw2">NO</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self presentModalViewController<span class="sy0">:</span>mailController animated<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>mailController release<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>mailComposeController<span class="sy0">:</span><span class="br0">&#40;</span>MFMailComposeViewController<span class="sy0">*</span><span class="br0">&#41;</span>mailController didFinishWithResult<span class="sy0">:</span><span class="br0">&#40;</span>MFMailComposeResult<span class="br0">&#41;</span>result error<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/"><span class="kw5">NSError</span></a><span class="sy0">*</span><span class="br0">&#41;</span>error <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self becomeFirstResponder<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self dismissModalViewControllerAnimated<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 8:</strong> Now Compile and run the application in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-75.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-75-232x300.jpg" alt="" title="1-7" width="232" height="300" class="alignnone size-medium wp-image-2509" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/MailComposer.zip">MailComposer</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/mail-send-from-ipad/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Display WebPage and AudioFile play in TabBar Application</title>
		<link>http://www.edumobile.org/iphone/ipad-development/display-webpage-and-audiofile-play-in-tabbar-application/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/display-webpage-and-audiofile-play-in-tabbar-application/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 10:17:58 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[Display WebPage and AudioFile Play]]></category>
		<category><![CDATA[Display WebPage and AudioFile play in TabBar Application]]></category>
		<category><![CDATA[iphone tutorials]]></category>

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

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2443</guid>
		<description><![CDATA[This is the simple View Base application. In this application we will display image,  button and label.]]></description>
			<content:encoded><![CDATA[<p>This is the simple View Base application. In this application we will display image,  button and label.</p>
<p><strong>Step 1: </strong>Create a View base application using template. Give the application name &#8220;ViewBase_iPad&#8221;.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> Xpand classes and notice Interface Builder created the ViewBase_iPadViewController class for you. Expand Resources and notice the template generated a separate nib,ViewBase_iPadViewController.xib, for the “ViewBase_iPad”.</p>
<p><strong>Step 4:</strong> In the ViewBase_iPadViewController.h file, we have created instance of UILabel and UIImage class. Define one IBAction method. So 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> ViewBase_iPadViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;IBOutlet UILabel <span class="sy0">*</span>myLabel;<br />
&nbsp;IBOutlet UIImage <span class="sy0">*</span>myImage;</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 UILabel <span class="sy0">*</span>myLabel;<br />
<span class="kw1">@property</span><span class="br0">&#40;</span>nonatomic,retain<span class="br0">&#41;</span> IBOutlet UIImage <span class="sy0">*</span>myImage;</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;</div>
</div>
<p><strong>Step 5:</strong> Double click the ViewBase_iPadViewController.xib file and open it to the Interface Builder.First drag the Image View from the library and place it to the View window. Next drag label and Round Rect from the library and place it to the view window. Select the Round Rect from the view window and bring up Connection iNspector. Drag from the Touch Up Inside to the File&#8217;s Owner icon and select ButtonPressed: method. Connect File&#8217;s Owner icon to the View icon and select view and connect File&#8217;s Owner icon to the label select myLabel. Now save the ViewBase_iPadViewController.xib file, close it and go back to the Xcode.</p>
<p><strong>Step 6:</strong> Open the ViewBase_iPadViewController.m file and make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span><span class="br0">&#40;</span>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<span class="br0">&#123;</span></p>
<p>myLabel.text <span class="sy0">=</span> <span class="co3">@</span><span class="st0">&quot;Welocome to the Real World!!!&quot;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 7:</strong> Now compile and run the application in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-73.jpg"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-73-232x300.jpg" alt="" title="1-7" width="232" height="300" class="alignnone size-medium wp-image-2444" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2010/07/ViewBase_iPad.zip'>ViewBase_iPad</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/viewbase-application-in-ipad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to play Video in iPad</title>
		<link>http://www.edumobile.org/iphone/ipad-development/how-to-play-video-in-ipad/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/how-to-play-video-in-ipad/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 08:28:19 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[How to play Video in iPad]]></category>
		<category><![CDATA[iPad tutorials]]></category>
		<category><![CDATA[Play Video]]></category>

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

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2403</guid>
		<description><![CDATA[In this application we will see how to image moved ,using touch function we will shift images any where of the screen.]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to image moved ,using touch function we will shift images any where of the screen.</p>
<p><strong>Step 1:</strong> Create a View base application using template. Give the application name “RotateImage”.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3: </strong>Xpand classes and notice Interface Builder created the RotateImageViewController class for you. Expand Resources and notice the template generated a separate nib,RotateImageViewController.xib, for the “RotateImage”.</p>
<p><strong>Step 4:</strong> We need to add UIView class in the project. Select Classes -&gt; Add -&gt; New File -&gt; Cocoa Touch Class -&gt; Objective C class -&gt; select UIView from the Subclass of. Give the file name &#8220;ImageView&#8221;.</p>
<p><strong>Step 5:</strong> We have added one resource in the Resources folder. Give the name of the resource &#8220;1.png&#8221;.</p>
<p><strong>Step 6:</strong> In the ImageView.h file, we specified the superclass as a UIImageView. So make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span><br />
&nbsp;<span class="kw1">@interface</span> ImageView <span class="sy0">:</span> UIImageView <span class="br0">&#123;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 7:</strong> Open the ImageView.m file , make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span> initWithImage<span class="sy0">:</span><span class="br0">&#40;</span>UIImage <span class="sy0">*</span><span class="br0">&#41;</span>image <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>self <span class="sy0">=</span> <span class="br0">&#91;</span>super initWithImage<span class="sy0">:</span>image<span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self setUserInteractionEnabled<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self setMultipleTouchEnabled<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">return</span> self;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span> touchesMoved<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSSet_Class/"><span class="kw5">NSSet</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>touches withEvent<span class="sy0">:</span><span class="br0">&#40;</span>UIEvent <span class="sy0">*</span><span class="br0">&#41;</span>event<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span>touches count<span class="br0">&#93;</span> <span class="sy0">==</span> 1<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CGPoint newTouch <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>touches anyObject<span class="br0">&#93;</span> locationInView<span class="sy0">:</span><span class="br0">&#91;</span>self superview<span class="br0">&#93;</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CGPoint lastTouch <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>touches anyObject<span class="br0">&#93;</span> previousLocationInView<span class="sy0">:</span> <span class="br0">&#91;</span>self superview<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">float</span> xDif <span class="sy0">=</span> newTouch.x <span class="sy0">-</span> lastTouch.x; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">float</span> yDif <span class="sy0">=</span> newTouch.y <span class="sy0">-</span> lastTouch.y;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CGAffineTransform translate <span class="sy0">=</span> CGAffineTransformMakeTranslation<span class="br0">&#40;</span>xDif, yDif<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self setTransform<span class="sy0">:</span> CGAffineTransformConcat<span class="br0">&#40;</span><span class="br0">&#91;</span>self transform<span class="br0">&#93;</span>, translate<span class="br0">&#41;</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 8:</strong> In the the RotateImageViewController.h file we have import &#8220;ImageView.h&#8221; file.</p>
<p><strong>Step 9:</strong> Open the RotateImageViewController.m file, we create ImageView and make it visible. So make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; 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> initWithImage<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><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>imageView setFrame<span class="sy0">:</span>CGRectMake<span class="br0">&#40;</span>110, 180, <span class="br0">&#91;</span>imageView frame<span class="br0">&#93;</span>.size.width,<span class="br0">&#91;</span>imageView frame<span class="br0">&#93;</span>.size.height<span class="br0">&#41;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span><span class="br0">&#91;</span>self view<span class="br0">&#93;</span> addSubview<span class="sy0">:</span>imageView<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>imageView release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 10: </strong>Now compile and run the application in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1.tiff"><img src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1.tiff" alt="" title="1" class="alignnone size-full wp-image-2407" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://www.edumobile.org/iphone/wp-content/uploads/2010/07/RotateImage.zip'>RotateImage</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/how-to-image-moved-using-touch-function-in-ipad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display images in TabBar Application in iPad</title>
		<link>http://www.edumobile.org/iphone/ipad-development/display-images-in-tabbar-application-in-ipad/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/display-images-in-tabbar-application-in-ipad/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 12:52:25 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[Display images]]></category>
		<category><![CDATA[Display images in TabBar Application in iPad]]></category>
		<category><![CDATA[iPad tutorials]]></category>

		<guid isPermaLink="false">http://www.edumobile.org/iphone/?p=2392</guid>
		<description><![CDATA[This is the very easy example . We will see how to  image display in the different tab in the TabBarApplication using only Interface Builder.]]></description>
			<content:encoded><![CDATA[<p>This is the very easy example . We will see how to  image display in the different tab in the TabBarApplication using only Interface Builder.</p>
<p><strong>Step 1:</strong> Create a TabBar Application using template. Give the application name “TabBarApplication_iPad”.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> Xpand classes and notice Interface Builder created the TabBarApplication_iPadViewController class for you. Expand Resources and notice the template generated a separate nib,TabBarApplication_iPadViewController.xib, for the “TabBarApplication_iPad”.</p>
<p><strong>Step 4:</strong> We need to add two images in the Resource folder. Give the images name &#8220;1.png&#8221;, &#8220;2.png&#8221;.</p>
<p><strong>Step 5: </strong>Double click the FirstView.xib file and open it to the Interface Builder. First drag the UIImageView from the library and place it to the View window. Select the UIImageView from the view and bring up Attribute Inspector and select the &#8220;1.png&#8221;. Connect File&#8217;s Owner icon to the View icon and select the view. Save the .xib file and go back to the Xcode.</p>
<p><strong>Step 6:</strong> Double click the SecondView.xib file and open it to the Interface Builder. First drag the UIImageView from the library and place it to the View window. Select the UIImageView from the view and bring up Attribute Inspector and select the &#8220;2.png&#8221;. Connect File&#8217;s Owner icon to the View icon and select the view. Save the .xib file and go back to the Xcode.</p>
<p><strong>Step 7: </strong>Now compile and run the application in the Simulator.</p>
<p><a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1.jpg"><img class="alignnone size-medium wp-image-2393" title="1" src="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/1-234x300.jpg" alt="" width="234" height="300" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href="http://www.edumobile.org/iphone/wp-content/uploads/2010/07/TabBarApplication_iPad.zip">TabBarApplication_iPad</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/display-images-in-tabbar-application-in-ipad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Draw Circle Triangle and Rectangle in iPad</title>
		<link>http://www.edumobile.org/iphone/ipad-development/draw-circle-triangle-and-rectangle-in-iphone/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/draw-circle-triangle-and-rectangle-in-iphone/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 10:19:45 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[Draw circle Triangle and Rectangle]]></category>
		<category><![CDATA[Draw Circle Triangle and Rectangle in iPad]]></category>
		<category><![CDATA[iPad tutorials]]></category>

		<guid isPermaLink="false">http://edumobile.org/iphone/?p=2178</guid>
		<description><![CDATA[This is the very simple tutorial. In this tutorial we will see how to draw Circle, Triangle and  Rectangle in the iPad.]]></description>
			<content:encoded><![CDATA[<p>This is the very simple tutorial. In this tutorial we will see how to draw Circle, Triangle and  Rectangle in the iPad.</p>
<p><strong>Step 1:</strong> Create a Window base application using template. Give the application name “ThreeViews”.</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  one UIView file in the project. Select classes-&gt; New File -&gt; Add -&gt;Cocoa Touch Class -&gt; Select Objective C class -&gt; Subclass of -&gt; UIView. Give the class name &#8220;CircleView&#8221;.</p>
<p><strong>Step 4:</strong> Open the ThreeViewsAppDelegate.m file and make the following changes in the file:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>applicationDidFinishLaunching<span class="sy0">:</span><span class="br0">&#40;</span>UIApplication <span class="sy0">*</span><span class="br0">&#41;</span>application <span class="br0">&#123;</span></p>
<p>CircleView <span class="sy0">*</span>view <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>CircleView alloc<span class="br0">&#93;</span> initWithFrame<span class="sy0">:</span><span class="br0">&#91;</span>window frame<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>window addSubview<span class="sy0">:</span>view<span class="br0">&#93;</span>;<br />
<span class="br0">&#91;</span>view release<span class="br0">&#93;</span>;</p>
<p><span class="br0">&#91;</span>window makeKeyAndVisible<span class="br0">&#93;</span>;</p>
<p><span class="br0">&#125;</span></div>
</div>
<p><strong>Step 5:</strong> Open the CicleView.m file and make the following changes in the drawRect: method.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>drawRect<span class="sy0">:</span><span class="br0">&#40;</span>CGRect<span class="br0">&#41;</span>rect <span class="br0">&#123;</span><br />
CGContextRef contextRef <span class="sy0">=</span> UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span>;</p>
<p>CGContextSetRGBFillColor<span class="br0">&#40;</span>contextRef, 0, 0, 255, 0.1<span class="br0">&#41;</span>;<br />
CGContextSetRGBStrokeColor<span class="br0">&#40;</span>contextRef, 0, 0, 255, 0.5<span class="br0">&#41;</span>;</p>
<p><span class="co2">// Draw a circle (filled)</span><br />
CGContextFillEllipseInRect<span class="br0">&#40;</span>contextRef, CGRectMake<span class="br0">&#40;</span>100, 100, 25, 25<span class="br0">&#41;</span><span class="br0">&#41;</span>;</p>
<p><span class="co2">// Draw a circle (border only)</span><br />
CGContextStrokeEllipseInRect<span class="br0">&#40;</span>contextRef, CGRectMake<span class="br0">&#40;</span>100, 100, 25, 25<span class="br0">&#41;</span><span class="br0">&#41;</span>;</p>
<p><span class="co2">// Get the graphics context and clear it</span><br />
CGContextRef ctx <span class="sy0">=</span> UIGraphicsGetCurrentContext<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
CGContextClearRect<span class="br0">&#40;</span>ctx, rect<span class="br0">&#41;</span>;</p>
<p><span class="co2">// Draw a green solid circle</span><br />
CGContextSetRGBFillColor<span class="br0">&#40;</span>ctx, 0, 255, 0, 1<span class="br0">&#41;</span>;<br />
CGContextFillEllipseInRect<span class="br0">&#40;</span>ctx, CGRectMake<span class="br0">&#40;</span>100, 100, 25, 25<span class="br0">&#41;</span><span class="br0">&#41;</span>;</p>
<p><span class="co2">// Draw a yellow hollow rectangle</span><br />
CGContextSetRGBStrokeColor<span class="br0">&#40;</span>ctx, 255, 255, 0, 1<span class="br0">&#41;</span>;<br />
CGContextStrokeRect<span class="br0">&#40;</span>ctx, CGRectMake<span class="br0">&#40;</span>195, 195, 60, 60<span class="br0">&#41;</span><span class="br0">&#41;</span>;</p>
<p><span class="co2">// Draw a purple triangle with using lines</span><br />
CGContextSetRGBStrokeColor<span class="br0">&#40;</span>ctx, 255, 0, 255, 1<span class="br0">&#41;</span>;<br />
CGPoint points<span class="br0">&#91;</span>6<span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span> CGPointMake<span class="br0">&#40;</span>100, 200<span class="br0">&#41;</span>, CGPointMake<span class="br0">&#40;</span>150, 250<span class="br0">&#41;</span>,<br />
CGPointMake<span class="br0">&#40;</span>150, 250<span class="br0">&#41;</span>, CGPointMake<span class="br0">&#40;</span>50, 250<span class="br0">&#41;</span>,<br />
CGPointMake<span class="br0">&#40;</span>50, 250<span class="br0">&#41;</span>, CGPointMake<span class="br0">&#40;</span>100, 200<span class="br0">&#41;</span> <span class="br0">&#125;</span>;<br />
CGContextStrokeLineSegments<span class="br0">&#40;</span>ctx, points, 6<span class="br0">&#41;</span>;</p>
<p><span class="br0">&#125;</span></div>
</div>
<p><strong>Step 6:</strong> Now compile and run the application in the Simulator.</p>
<p><a href="http://edumobile.org/iphone/wp-content/uploads/2010/06/23.jpg"><img class="alignnone size-medium wp-image-2179" title="23" src="http://edumobile.org/iphone/wp-content/uploads/2010/06/23-162x300.jpg" alt="" width="162" height="300" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href="http://edumobile.org/iphone/wp-content/uploads/2010/06/ThreeViews1.zip">ThreeViews</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/draw-circle-triangle-and-rectangle-in-iphone/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Display Map Wed using ButtonPress in iPad</title>
		<link>http://www.edumobile.org/iphone/ipad-development/display-map-wed-using-buttonpress-in-ipad/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/display-map-wed-using-buttonpress-in-ipad/#comments</comments>
		<pubDate>Tue, 11 May 2010 07:55:24 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[Display Map Wed using ButtonPress in iPad]]></category>
		<category><![CDATA[display Web and Map in iPad]]></category>
		<category><![CDATA[iPad tutorial]]></category>

		<guid isPermaLink="false">http://edumobile.org/iphone/?p=1961</guid>
		<description><![CDATA[In this application you can see how to display WebPage, Map using ButtonPress in the iPad. This is the very simple example. Let see how it will be worked.
]]></description>
			<content:encoded><![CDATA[<p>In this application you can see how to display WebPage, Map using ButtonPress in the iPad. This is the very simple example. Let see how it will be worked.</p>
<p><strong>Step 1:</strong> Create a application using Window base template. Give the application name &#8220;WebMapDisplay&#8221;.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3: </strong>Expand classes and notice Interface Builder created the OpenBrowserAppDelegate class for you. Expand Resources and notice the template generated a separate nib MainWindow.xib for the &#8220;WebMapDisplay&#8221;.</p>
<p><strong>Step 4:</strong> We need to add two UIViewController class to the project. Choose New file -&gt; Select cocoa touch classes group and then select UIViewController . Give the class name &#8220;WebMapDisplayViewC0ntroller&#8221;, create another ViewController class and corresponding .xib file, give the class name &#8220;MainViewController&#8221;. Now add UIViewclass, Choose New file-&gt; Select cocoa touch class -&gt; select Objective C class -&gt; select UIView from the Subclass of. Also create corresponding .xib file . Give the class name &#8220;MainView&#8221;.</p>
<p><strong>Step 5:</strong> Open the AppDelegate.h file and add WebMapDisplayViewController class, and create an instance of the class. 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> WebMapDisplayViewController;</p>
<p><span class="kw1">@interface</span> WebMapDisplayAppDelegate <span class="sy0">:</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span class="kw5">NSObject</span></a> &lt;UIApplicationDelegate&gt; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp;UIWindow <span class="sy0">*</span>window;<br />
&nbsp; &nbsp; &nbsp;WebMapDisplayViewController <span class="sy0">*</span>webMapDisplayViewController;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UIWindow <span class="sy0">*</span>window;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet WebMapDisplayViewController <span class="sy0">*</span>webMapD</div>
</div>
<p><strong>Step 6:</strong> In the AppDelegate.m file make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>application<span class="sy0">:</span><span class="br0">&#40;</span>UIApplication <span class="sy0">*</span><span class="br0">&#41;</span>application didFinishLaunchingWithOptions<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span class="kw5">NSDictionary</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>launchOptions <span class="br0">&#123;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; <span class="br0">&#91;</span>window addSubview<span class="sy0">:</span><span class="br0">&#91;</span>webMapDisplayViewController view<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>window makeKeyAndVisible<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">YES</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 7:</strong> Now open the WebMapDisplayViewController.h file, we have added MainViewController class and create an object of the class, add UIButton . So now 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 />
&nbsp;<span class="kw1">@class</span> MainViewController;<br />
&nbsp;<span class="kw1">@interface</span> WebMapDisplayViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp;MainViewController <span class="sy0">*</span>mainViewController;<br />
&nbsp; &nbsp; &nbsp;IBOutlet UIButton <span class="sy0">*</span>infoButton;</p>
<p><span class="br0">&#125;</span><br />
&nbsp;<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> MainViewController <span class="sy0">*</span>mainViewController;<br />
&nbsp;<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UIButton <span class="sy0">*</span>infoButton;</div>
</div>
<p><strong>Step 8:</strong> Double click the MainWindow.xib file and open it to the Interface Builder. First drag the ViewController from the library and place it to the Main window. Select the View Controller and bring up Identity Inspector, change the class name into the WebMapDisplayViewController. Now open the WebMapDisplayViewController, drag the Round Rect from the library and place it to the view window select the Round Rect and bring up Attributes Inspector  then change the type of the button into info Light. Select the WebMapDisplayViewController icon from the main window and bring up Connection Inspector drag from infoButton to the Light info button. Now save the nib file, close it and go back to the Xcode.</p>
<p><strong>Step 9:</strong> Open the WebMapDisplayViewController.m file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; MainViewController <span class="sy0">*</span>viewController<span class="sy0">=</span><span class="br0">&#91;</span><span class="br0">&#91;</span>MainViewController alloc<span class="br0">&#93;</span> initWithNibName<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;MainView&quot;</span> bundle<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; self.mainViewController <span class="sy0">=</span> viewController;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>viewController release<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self.view insertSubview<span class="sy0">:</span>mainViewController.view belowSubview<span class="sy0">:</span>infoButton<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 10:</strong> In the MainViewController.h file we have added two method fro display map and webpage. So 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> MainViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
<span class="br0">&#125;</span><br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>ShowMap;<br />
<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>ShowBrowser;</div>
</div>
<p><strong>Step 11:</strong>Double click the MainViewController.xib file and open it to the Interface Builder. Select the File&#8217;s Owner icon from the MainWindow and bring up Identity Inspector and change the class name into MainViewController. Next select the View icon from the mainwindow and bring up Identity Inspector and change the class name into &#8220;MainView&#8221;.Drag two Round Rect from the library and place it to the view window. Give the Round Rect name &#8220;OpenMap&#8221; and &#8220;OpenBrowser&#8221;. Connect File&#8217;s Owner icon to the MainView icon and select view. Select OpenMap from the view window and bring up Connection Inspector and drag TouchUpInside to the File&#8217;s owner icon and select ShowMap: method, do it once again for OpenBrowser and select ShowBrowser: method. Now save the .xib file, close    it and go back to the Xcode.</p>
<p><strong>Step 12: </strong>Open the MainViewController.m file and make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>ShowMap<br />
<span class="br0">&#123;</span><br />
&nbsp; <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a><span class="sy0">*</span> mapUrl <span class="sy0">=</span> <span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> stringWithFormat<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;http://maps.google.com/maps?q=%@&quot;</span><span class="br0">&#93;</span>;<br />
&nbsp; <span class="br0">&#91;</span><span class="br0">&#91;</span>UIApplication sharedApplication<span class="br0">&#93;</span> openURL<span class="sy0">:</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> URLWithString<span class="sy0">:</span>mapUrl<span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>ShowBrowser<br />
<span class="br0">&#123;</span><br />
&nbsp; <span class="br0">&#91;</span><span class="br0">&#91;</span>UIApplication sharedApplication<span class="br0">&#93;</span> openURL<span class="sy0">:</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> URLWithString<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;http://google.com&quot;</span><span class="br0">&#93;</span><span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 13:</strong> Now compile and run the application in the Simulator.</p>
<p><a href="http://edumobile.org/iphone/wp-content/uploads/2010/05/op_ipad-1.jpg"><img src="http://edumobile.org/iphone/wp-content/uploads/2010/05/op_ipad-1-233x300.jpg" alt="" title="op_ipad-1" width="233" height="300" class="alignnone size-medium wp-image-1967" /></a></p>
<p>You can <strong>download SourceCode</strong> from here  <a href='http://edumobile.org/iphone/wp-content/uploads/2010/05/WebMapDisplay.zip'>WebMapDisplay</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/display-map-wed-using-buttonpress-in-ipad/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to changeView in the iPad</title>
		<link>http://www.edumobile.org/iphone/ipad-development/how-to-changeview-in-the-ipad/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/how-to-changeview-in-the-ipad/#comments</comments>
		<pubDate>Fri, 07 May 2010 11:28:07 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[ChangeView in iPad]]></category>
		<category><![CDATA[How to changeView in the iPad]]></category>

		<guid isPermaLink="false">http://edumobile.org/iphone/?p=1953</guid>
		<description><![CDATA[In this application we will see how to change view using button pressed. This is the very simple application. Let see how it will be worked.]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to change view using button pressed. This is the very simple application. Let see how it will be worked.</p>
<p><strong>Step 1: </strong>Create a application using Window base template. Give the application name &#8220;MultiViewiPad&#8221;.</p>
<p><strong>Step 2: </strong>Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3: </strong>We need to add three UIViewController class to the project. Choose New file -&gt; Select cocoa touch classes group and then select UIViewController . Give the file names  “SwitchViewController”, “FirstViewController” and create corresponding .xib file, and create  another class ”SecondViewController ” and corresponding .xib file.</p>
<p><strong>Step 4: </strong>We need to add images in the Resources folder. Give the name of the images “1.png”,”2.png”.</p>
<p><strong>Step 5:</strong> In the AppDelegate.h file , we have added SwitchViewController class. So make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span></p>
<p><span class="kw1">@class</span> SwitchViewController;</p>
<p><span class="kw1">@interface</span> MultiViewiPadAppDelegate <span class="sy0">:</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span class="kw5">NSObject</span></a> &lt;UIApplicationDelegate&gt; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; UIWindow <span class="sy0">*</span>window;<br />
&nbsp; &nbsp; &nbsp; &nbsp; IBOutlet SwitchViewController <span class="sy0">*</span>switchViewController;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UIWindow <span class="sy0">*</span>window;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet SwitchViewController <span class="sy0">*</span>switchViewController;</div>
</div>
<p><strong>Step 6:</strong> Open the AppDelegate.m file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>application<span class="sy0">:</span><span class="br0">&#40;</span>UIApplication <span class="sy0">*</span><span class="br0">&#41;</span>application didFinishLaunchingWithOptions<span class="sy0">:</span><span class="br0">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span class="kw5">NSDictionary</span></a> <span class="sy0">*</span><span class="br0">&#41;</span>launchOptions <span class="br0">&#123;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>window addSubview<span class="sy0">:</span>switchViewController.view<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>window makeKeyAndVisible<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">YES</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 7: </strong>Now open the SwitchViewController.h file, we have added FirstViewController and SecondViewController class in the file and added one ChangeView method  . Make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span></p>
<p><span class="kw1">@class</span> FirstViewController;<br />
<span class="kw1">@class</span> SecondViewController;</p>
<p>
<span class="kw1">@interface</span> SwitchViewController <span class="sy0">:</span> UIViewController <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; FirstViewController <span class="sy0">*</span>firstViewController;<br />
&nbsp; &nbsp; &nbsp; &nbsp; SecondViewController <span class="sy0">*</span>secondViewController;</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> FirstViewController <span class="sy0">*</span>firstViewController;<br />
<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> SecondViewController <span class="sy0">*</span>secondViewController;</p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>ChangeView<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span>sender;</div>
</div>
<p><strong>Step 8:</strong> Double click MainWindow.xib file and open it to the Interface Builder. First drag ViewController from the library and place it to the MainWindow.Select the ViewController icon from theMainWindow and bring up Identity inspector and change the class name into SwitchViewController. Open the SwitchViewController and drag the View from the library and place it,in the SwitchViewController view. Next drag Toolbar from the library and place it buttom portion of the view and drag Bar Button Item from the library and place it on the ToolBar . Change the Bar Button Item name into Switch Views. Connect the MultiViewiPadAppDelegate icon to the SwitchViewController icon and select switchViewController. Select the SwitchViewController icon from the MainWindow and bring up Connection Inspector, drag from the ChangeView to the Bar Button Item. You have done all the connection, so now save the SwitchViewController.xib file , close it and go back to the Xcode.</p>
<p><strong>Step 9: </strong>Open the SwitchViewController.m file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; FirstViewController <span class="sy0">*</span>firstView <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>FirstViewController alloc<span class="br0">&#93;</span> initWithNibName<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;FirstViewController&quot;</span> bundle<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.firstViewController <span class="sy0">=</span> firstView;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self.view insertSubview<span class="sy0">:</span>firstView.view atIndex<span class="sy0">:</span>0<span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>firstView release<span class="br0">&#93;</span>; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="br0">&#91;</span>super viewDidLoad<span class="br0">&#93;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>ChangeView<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 />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>UIView beginAnimations<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;View Flip&quot;</span> context<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; <span class="br0">&#91;</span>UIView setAnimationDuration<span class="sy0">:</span>1.25<span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; <span class="br0">&#91;</span>UIView setAnimationCurve<span class="sy0">:</span>UIViewAnimationCurveEaseInOut<span class="br0">&#93;</span>; <br />
&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>self.secondViewController.view.superview <span class="sy0">==</span> <span class="kw2">nil</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>self.secondViewController <span class="sy0">==</span> <span class="kw2">nil</span><span class="br0">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SecondViewController <span class="sy0">*</span>secondView <span class="sy0">=</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span><span class="br0">&#91;</span>SecondViewController alloc<span class="br0">&#93;</span> initWithNibName<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;SecondViewController&quot;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bundle<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.secondViewController <span class="sy0">=</span> secondView; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>secondView release<span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>UIView setAnimationTransition<span class="sy0">:</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;UIViewAnimationTransitionFlipFromRight <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;forView<span class="sy0">:</span>self.view cache<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>firstViewController viewWillAppear<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>secondViewController viewWillDisappear<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>firstViewController.view removeFromSuperview<span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self.view insertSubview<span class="sy0">:</span>secondViewController.view atIndex<span class="sy0">:</span>0<span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>secondViewController viewDidDisappear<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>firstViewController viewDidAppear<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span> <br />
&nbsp; &nbsp; <span class="br0">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>self.firstViewController <span class="sy0">==</span> <span class="kw2">nil</span><span class="br0">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FirstViewController <span class="sy0">*</span>firstView <span class="sy0">=</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span><span class="br0">&#91;</span>FirstViewController alloc<span class="br0">&#93;</span> initWithNibName<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;FirstViewController&quot;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bundle<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.firstViewController <span class="sy0">=</span> firstView; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>firstView release<span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>UIView setAnimationTransition<span class="sy0">:</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;UIViewAnimationTransitionFlipFromLeft <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;forView<span class="sy0">:</span>self.view cache<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>secondViewController viewWillAppear<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>firstViewController viewWillDisappear<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>secondViewController.view removeFromSuperview<span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>self.view insertSubview<span class="sy0">:</span>firstViewController.view atIndex<span class="sy0">:</span>0<span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>firstViewController viewDidDisappear<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#91;</span>secondViewController viewDidAppear<span class="sy0">:</span><span class="kw2">YES</span><span class="br0">&#93;</span>; <br />
&nbsp; &nbsp; <span class="br0">&#125;</span> <br />
&nbsp; &nbsp; <span class="br0">&#91;</span>UIView commitAnimations<span class="br0">&#93;</span>; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 10: </strong>Double click the FirstViewController.xib file and open it to the Interface Builder. First drag the image view from the library and place it to the view window, select the view and bring up Attribute Inspector, select the image &#8220;1.png&#8221;. Connect the File&#8217;s Owner icon to the View icon and select the view. Do the same for SecondViewController.xib file just select the image &#8220;2.png&#8221;. Now save the .xib file, close it and go back to the Xcode.</p>
<p><strong>Step 11:</strong> Its all ready ,now compile and run the application in Simulator.</p>
<p><a href="http://edumobile.org/iphone/wp-content/uploads/2010/05/po_view.jpg"><img class="alignnone size-medium wp-image-1955" title="po_view" src="http://edumobile.org/iphone/wp-content/uploads/2010/05/po_view-235x300.jpg" alt="" width="235" height="300" /></a></p>
<p>You can <strong>Download SourceCode</strong> from here <a href='http://edumobile.org/iphone/wp-content/uploads/2010/05/MultiViewiPad.zip'>MultiViewiPad</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/how-to-changeview-in-the-ipad/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>TabBarController Application in iPad</title>
		<link>http://www.edumobile.org/iphone/ipad-development/tabbarcontroller-application-in-ipad/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/tabbarcontroller-application-in-ipad/#comments</comments>
		<pubDate>Thu, 06 May 2010 08:02:25 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[iPad application]]></category>
		<category><![CDATA[TabBar Application]]></category>
		<category><![CDATA[TabBarController Application in iPad]]></category>

		<guid isPermaLink="false">http://edumobile.org/iphone/?p=1935</guid>
		<description><![CDATA[TabBarController Application, in this application we will see how to run it in the iPad. This is the very simple application, i will show you using only Interface Builder how to implement simple TabBarController application in the iPad. So let see how it will be worked.]]></description>
			<content:encoded><![CDATA[<p>TabBarController Application, in this application we will see how to run it in the iPad. This is the very simple application, i will show you using only Interface Builder how to implement simple TabBarController application in the iPad. So let see how it will be worked.</p>
<p><strong>Step 1</strong>: Create a new project using TabBar Application template. Give the application name &#8220;TabBarApplicationiPad&#8221;.</p>
<p><a href="http://edumobile.org/iphone/wp-content/uploads/2010/05/fig0.jpg"><img class="alignnone size-medium wp-image-1937" title="fig0" src="http://edumobile.org/iphone/wp-content/uploads/2010/05/fig0-300x219.jpg" alt="" width="300" height="219" /></a></p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> xpand classes and notice Interface Builder created the FirstViewController and SecondViewController classes for you. Expand Resources and notice the template generated a separate nibs, FirstViewController.xib andSecondViewController.xib , for the “TabBarApplicationiPad”.</p>
<p><strong>Step 4:</strong> Double click the MainWindow.xib file and open it to the Interface Builder. Then you can see the in MainWindow.xib file TabBarController already included there. Open the TabBar Controller view and click the First Tab, then it will show you View loaded from the FirstView. That means First Tab content loaded from the FirstView.xib file (See the below figure).</p>
<p><a href="http://edumobile.org/iphone/wp-content/uploads/2010/05/fig1-1.jpg"><img class="alignnone size-medium wp-image-1938" title="fig1-1" src="http://edumobile.org/iphone/wp-content/uploads/2010/05/fig1-1-300x196.jpg" alt="" width="300" height="196" /></a></p>
<p><strong>Step 5: </strong>Now double click the FirstView.xib file and open it to the Interface Builder. Open the View window, click on it and bring up Attribute Inspector next the background color. Next drag the label from the library and place it to the view window and give the label name &#8220;First View&#8221;(See in the below figure). Now save it, close it and go back to the Xcode.</p>
<p><a href="http://edumobile.org/iphone/wp-content/uploads/2010/05/fig2-1.jpg"><img class="alignnone size-medium wp-image-1941" title="fig2-1" src="http://edumobile.org/iphone/wp-content/uploads/2010/05/fig2-1-300x228.jpg" alt="" width="300" height="228" /></a></p>
<p><strong>Step 6:</strong> Open the SecondView.xib file in the Interface Builder.Open the view window, click on it and bring up Attribute Inspector and change the background color. Next drag the label from the library and place it to the view window and give the label name &#8220;Second View&#8221; (See in the below figure). Now save it, close it and go back to the Xcode.</p>
<p><a href="http://edumobile.org/iphone/wp-content/uploads/2010/05/fig3.jpg"><img class="alignnone size-medium wp-image-1942" title="fig3" src="http://edumobile.org/iphone/wp-content/uploads/2010/05/fig3-300x217.jpg" alt="" width="300" height="217" /></a></p>
<p><strong>Step 7: </strong>After doing in 6 simple step, your application will be ready for run in the Simulator. So now compile and run it in the Simulator.</p>
<p><a href="http://edumobile.org/iphone/wp-content/uploads/2010/05/op_ipad.jpg"><img class="alignnone size-medium wp-image-1945" title="op_ipad" src="http://edumobile.org/iphone/wp-content/uploads/2010/05/op_ipad-233x300.jpg" alt="" width="233" height="300" /></a></p>
<p>You can <strong>download SourceCode</strong> from here  <a href='http://edumobile.org/iphone/wp-content/uploads/2010/05/TabBarApplicationiPad.zip'>TabBarApplicationiPad</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/tabbarcontroller-application-in-ipad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Playing Audio file in iPad</title>
		<link>http://www.edumobile.org/iphone/ipad-development/playing-audio-file-in-ipad/</link>
		<comments>http://www.edumobile.org/iphone/ipad-development/playing-audio-file-in-ipad/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 13:03:49 +0000</pubDate>
		<dc:creator>Sushant</dc:creator>
				<category><![CDATA[iPad Development]]></category>
		<category><![CDATA[ipad programming]]></category>
		<category><![CDATA[Playing Audio file]]></category>
		<category><![CDATA[Playing Audio file in iPad]]></category>

		<guid isPermaLink="false">http://edumobile.org/iphone/?p=1876</guid>
		<description><![CDATA[In this application we will see how to audio file playing in the iPad. Basically this is the very easy application. So let see how it will be worked.]]></description>
			<content:encoded><![CDATA[<p>In this application we will see how to audio file playing in the iPad. Basically this is the very easy application. So let see how it will be worked.</p>
<p><strong>Step 1: </strong>Create a new project in Xcode using View base application. Give the application name &#8220;MusicPlayiPad&#8221;.</p>
<p><strong>Step 2:</strong> Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.</p>
<p><strong>Step 3:</strong> xpand classes and notice Interface Builder created the MusicPlayiPadViewController class for you. Expand Resources and notice the template generated a separate nib, MusicPlayiPadViewController.xib, for the “MusicPlayiPad”.</p>
<p><strong>Step 4:</strong> In this application, we need to add two frameworks.So select Frameworks -&gt; Add -&gt; Existing Framework -&gt; then select AVFoundation.framework and AudioToolbox.framework.</p>
<p><strong>Step 5:</strong> We need to add sound files in the Resources folder. Give the name of the sound files “music.mp3”,”sound.aif”.</p>
<p><strong>Step 6:</strong> Open the MusicPlayiPadViewController.h file, we have added in this file AVAudioPlayerDelegate protocol. They allow a delegate to respond to audio interruptions , to audio decoding errors , and to the completion of a sound’s playback. Added SystemSoundID for playing sound, AVAudioPlayer for playing song, UIButton for display the button and mention two IBAction. So make the following changes in the file.</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="co1">#import &lt;UIKit/UIKit.h&gt;</span><br />
&nbsp; <span class="co1">#import &lt;AudioToolbox/AudioToolbox.h&gt;</span><br />
&nbsp; <span class="co1">#import &lt;AVFoundation/AVFoundation.h&gt;</span></p>
<p>&nbsp;<span class="kw1">@interface</span> MusicPlayiPadViewController <span class="sy0">:</span> UIViewController <br />
&nbsp;&lt;AVAudioPlayerDelegate&gt;<br />
&nbsp;<span class="br0">&#123;</span><br />
&nbsp; &nbsp;SystemSoundID systemSoundID;<br />
&nbsp; &nbsp;AVAudioPlayer <span class="sy0">*</span>player;<br />
&nbsp; &nbsp;UIButton <span class="sy0">*</span>StartStopSound;<br />
<span class="br0">&#125;</span></p>
<p>&nbsp;<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet AVAudioPlayer <span class="sy0">*</span>player;<br />
&nbsp;<span class="kw1">@property</span> <span class="br0">&#40;</span>nonatomic, retain<span class="br0">&#41;</span> IBOutlet UIButton <span class="sy0">*</span>StartStopSound;</p>
<p>&nbsp;<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> playSound<span class="sy0">:</span> <span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span> sender;<br />
&nbsp;<span class="sy0">-</span> <span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> playSong<span class="sy0">:</span> <span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span> sender;</div>
</div>
<p><strong>Step 7: </strong>Double click the MusicPlayiPadViewController.xib file and open it to the Interface Builder. Open the view window and first drag two Round Rect from the library and place it to the view window change the Round Rect name into &#8220;Play Sound&#8221; and &#8220;PlaySong&#8221;. Next connect File&#8217;s Owner icon to the view icon and select view. Select the Play Sound button from view window and bring up connection inspector, next drag from the TouchUpInside to the File&#8217;s Owner icon and select playSound: action. Do it once more time for Play Song button and select playSong: action and drag from the File&#8217;s Owner icon to the Play Sound button and select StartStopSound. Done all connection, now save NIB file, close it and go back to the Xcode.</p>
<p><strong>Step 8: </strong>Open the MusicPlayiPadViewController.m file and make the following changes:</p>
<div class="codesnip-container" >
<div class="objc codesnip" style="font-family:monospace;"><span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; <span class="sy0">-</span> <span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>viewDidLoad <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NSLog<span class="br0">&#40;</span><span class="co3">@</span><span class="st0">&quot;InView did load&quot;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; AudioServicesCreateSystemSoundID<span class="br0">&#40;</span><span class="br0">&#40;</span>CFURLRef<span class="br0">&#41;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> fileURLWithPath<span class="sy0">:</span><span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span class="kw5">NSBundle</span></a> mainBundle<span class="br0">&#93;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pathForResource<span class="sy0">:</span> <span class="co3">@</span><span class="st0">&quot;sound&quot;</span> ofType<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;aif&quot;</span><span class="br0">&#93;</span><span class="br0">&#93;</span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="sy0">&amp;</span>systemSoundID<span class="br0">&#41;</span>;</p>
<p>&nbsp; player <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>AVAudioPlayer alloc<span class="br0">&#93;</span><br />
&nbsp; initWithContentsOfURL<span class="sy0">:</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span class="kw5">NSURL</span></a> fileURLWithPath<span class="sy0">:</span><br />
&nbsp; <span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/"><span class="kw5">NSBundle</span></a> mainBundle<span class="br0">&#93;</span> pathForResource<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;music&quot;</span> ofType<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;mp3&quot;</span><span class="br0">&#93;</span><span class="br0">&#93;</span><br />
&nbsp; error<span class="sy0">:</span><span class="kw2">nil</span><span class="br0">&#93;</span>;</p>
<p>&nbsp; <span class="br0">&#91;</span>player prepareToPlay<span class="br0">&#93;</span>;</p>
<p><span class="br0">&#125;</span></p>
<p>&nbsp;<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> playSound<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span> sender <span class="br0">&#123;</span><br />
&nbsp; AudioServicesPlaySystemSound<span class="br0">&#40;</span>systemSoundID<span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></p>
<p>&nbsp;<span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span> playSong<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">id</span><span class="br0">&#41;</span> sender <span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#91;</span><span class="br0">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span class="kw5">NSString</span></a> stringWithFormat<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;%@&quot;</span>, <span class="br0">&#91;</span>StartStopSound &nbsp; &nbsp; titleForState<span class="sy0">:</span>UIControlStateNormal<span class="br0">&#93;</span><span class="br0">&#93;</span> isEqualToString<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Play Song&quot;</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; <span class="br0">&#91;</span>player play<span class="br0">&#93;</span>;<br />
&nbsp; <span class="br0">&#91;</span>StartStopSound setTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Stop Song&quot;</span> forState<span class="sy0">:</span>UIControlStateNormal<span class="br0">&#93;</span>; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; <span class="br0">&#91;</span>player stop<span class="br0">&#93;</span>;<br />
&nbsp; <span class="br0">&#91;</span>StartStopSound setTitle<span class="sy0">:</span><span class="co3">@</span><span class="st0">&quot;Play Song&quot;</span> forState<span class="sy0">:</span>UIControlStateNormal<span class="br0">&#93;</span>;<br />
&nbsp;<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p><strong>Step 9: </strong>Now compile and run the application in the Simulator.</p>
<p><a href="http://edumobile.org/iphone/wp-content/uploads/2010/04/sound-op.jpg"><img class="alignnone size-medium wp-image-1885" title="sound-op" src="http://edumobile.org/iphone/wp-content/uploads/2010/04/sound-op-242x300.jpg" alt="" width="242" height="300" /></a></p>
<p>download the <strong>SourceCode</strong> from here  <a href='http://edumobile.org/iphone/wp-content/uploads/2010/04/MusicPlayiPad1.zip'>MusicPlayiPad</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.edumobile.org/iphone/ipad-development/playing-audio-file-in-ipad/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

