开发者

Interface Builder in Xcode 4

I just can't find the "Create iPad version" button in Xcode 4 because I want to turn an iPhone XIB in an iPad XIB, does any开发者_运维百科body know where I can find this button in Xcode4?


This is somewhat hidden. You'll need to create a duplicate target. Select the project in the navigator, then right-click the target and select Duplicate. Choose to Duplicate and Transition to iPad. A group called "Resources-iPad" will be added to your project and will contain the iPad-converted xibs.


You can also do a search-and-replace on a copy of your iPhone .xib file in a text editor, replacing the term "IBCocoaTouchFramework" with "IBIPadFramework".


In addition to Joshua's step you need to set the target to iPhone or it doesn't give you the option to "Choose to Duplicate and Transition to iPad". If the target is set to universal it does not work.


A slightly longer way, to build one from scratch. When all else fails, try the following:

You have to create, through Xcode4, a new MainWindow file for the iPad version.

In Xcode 4, File > New File. Choose IOS > User Interface > Application, then Next. Choose Device Family (assume iPad). Call it MainWindow-iPad.

This creates a new MainWindow-iPad.xib file. Now, you have to link it to the app delegate.

Click on the new MainWindow-iPad.xib file under your file tab. Click on App Delegate. In the inspector window, choose the 3rd pushpin. This is the identity inspector. Choose the class of your appDelegate.

Now, link it to the window for the screen, plus add any navigation controllers, etc., for this screen. Go back to the app delegate row under objects, and control-click from the app delegate to the Window, to make that an outlet. Drag Tab bar controller from the library, and add it below the window. Control-click on the app delegate, dragging to the tab bar controller. Make that an outlet.

This gives you a complete MainWindow-iPad file.

Now, select the Target, change deployment to Universal, and change the Main Interface under iPad Deployment Info to MainWindow-iPad.

That should do it!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜