首页 > 代码库 > xib中的view对iPhone和iPad自适应

xib中的view对iPhone和iPad自适应

1

This worked for me:

    Make a copy of the .xib in the Finder.
    Open the copied file in a text editor.
    Change "com.apple.InterfaceBuilder3.CocoaTouch.XIB" to "com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB".
    Change all instances of "IBCocoaTouchFramework" to "IBIPadFramework".
    Search for sizes like {480, 320} and edit them. Or just reopen the file in Xcode and use the GUI to resize items as needed.

This also works in reverse, if you need to change an iPad xib into an iPhone xib.

2

Select the target (in XCODE4 it‘s shown when you select the project). Once selected use the contextual menu to "Duplicate" it. It will ask you want to "Duplicate and transition to iPad". Then all the XIBS will be duplicated with the new iPad size.