Xcode 4.2 , change the iPhone xib to iPad xib

I have created the project which consists of 5 xibs. When I try to run the project in the iPad simulator . Some of the Xibs are coming in the iPhone screen size. I want to convert those iphone xibs which will support the iPad Xib screen size. Any idea how to do it ?

NOTE: I want to support both the iPhone and iPad


You can convert iPhone xib into iPad xib using following step.

Right click the file (in xcode) and Open As > Source Code

The 2nd line should look like:

<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
Replace with:

<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="7.10">

Search for "IBCocoaTouchFramework" and Replace all occurrences with "IBIPadFramework"

Save the file and Open As > Interface Builder - iOS

you can do this for al xib...and you have your iPhone xib now in iPad xib.

Hope, this will help you..


我认为这对你会有所帮助

 if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
            self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease];
        } else {
            self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil] autorelease];
    }

然后,你应该创建你的项目或更新你的项目通用和更改ipad xib设置和自动调整它。

链接地址: http://www.djcxy.com/p/95712.html

上一篇: 在iPad上运行的iPhone应用程序会加载带〜ipad扩展名的xib

下一篇: Xcode 4.2,将iPhone xib更改为iPad xib