Archive

Archive for August, 2010

iPhone/iPad Universal Binary Sample Code

August 21st, 2010 5 comments

Let me provide my template project of universal binary for iPhone and iPad here. This is very simple project, you may be able to read easily. My code would not be 100% correct, but mostly okay to understand how organize universal application, I believe.

[ Rights ]

This is so simple codes, I do not assert copyright. I provide this code without guarantees If you use this code, please take your own risk.

[ Abstract of the project ]

- When the program runs on the iPhone, table view will be showed at beginning. Then tap the item to show content.

- When the program runs on the iPad, split view will be displayed to show both table items and content.

[ Summary ]

This project was created on Xcode 3.2.3 SDK 4.0.1.

Brief steps to build this project as follows.

  • Created iPhone application
    • Created Navigation-based Application
    • Created class and nib file as ‘DetailedViewController’.
    • Created data model class ‘MyEngine’. ‘MyEngine’ is owned by RootViewController.
  • Converted to universal binary
    • Selected target and performed ‘Upgrade current target for iPad’ with ‘One universal application’ option
    • Removed UINavigationController property in UniTest2AppDelegate class and add UIViewController property. Reconnected it from MainWindow.xib
    • Created DetailViewController-iPad class and nib with ‘Targeted for iPad’ option. Note: Class name would become ‘DetailViewController_iPad’ automatically
    • Created RootViewController-iPad class files as sub-class of TableViewController. (class name became RootViewController_iPad)
    • Created MainWindow-iPad.xib and added Split View Controller
Categories: iPhone/iPod Touch, Programming Tags: