Universal app supports both ipad and iphone. The most straightforward way to understand how universal supports both ipad and iphone is to create a universal project.
Universal basic features of project:
1. Target > Summary > Devices is universal
2. Xib for ipad and xib for iphone can share the same view controller, of course using a different view controller absolutely no problem.
3. In the APPDELEGATE.M Didfinishlaunchingwithoptions method, use following code to specify access different view depending on whether the device is an ipad or an iphone
[CPP]View Plaincopy
- Self.window = [[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];
- if ([[Uidevice currentdevice] userinterfaceidiom] = = Uiuserinterfaceidiomphone) {
- Self.viewcontroller = [[Viewcontroller alloc] initwithnibname:@"Viewcontroller_iphone" bundle:nil];
- } Else {
- Self.viewcontroller = [[Viewcontroller alloc] initwithnibname:@"Viewcontroller_ipad" bundle:nil];
- }
- <pre name="code" class="cpp" > Self.window.rootViewController = self.viewcontroller;</pre> [ Self.window makekeyandvisible];<p></p>
- <pre></pre>
- <br>
- 4. Other class can also be <br>
- <p></p>
- <p></p><pre name="code" class="cpp" >[[uidevice Currentdevice] Userinterfaceidiom] </pre> to determine whether it's an ipad or an iphone to perform different codes <p></p>
- <p><br>
- </p>
- <p><strong><span style="color: #ff0000" > How to convert iphone app to Universal app? </span></strong></p>
- <p> is very simple, just set the target > Summary > Devices option to Universal. Of course you have to create your own set of UI for the ipad and specify a different view based on the device in the DELEGATE.M. </p>
- <p><br>
- </p>
- <p>ref links:</p>
- <p><a href="http://richielin-programer.blogspot.com/2010/06/iphone-ipad-universal-app.html" > Http://richielin-programer.blogspot.com/2010/06/iphone-ipad-universal-app.html</a><br>
- </p>
- <p><a href="http://iphonedevelopment.blogspot.com/2010/04/converting-iphone-apps-to-universal.html ">http://iphonedevelopment.blogspot.com/2010/04/converting-iphone-apps-to-universal.html</a><br >
- </p>
- <p><br>
- </p>
- <p><br>
- </p>
- <div><br>
- </div>
IOS: Create Universal App