Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4.2 , change the iPhone xib to iPad xib

Tags:

ios

iphone

xib

ipad

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

like image 749
Perseus Avatar asked May 05 '12 06:05

Perseus


4 Answers

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..

like image 187
Nitin Avatar answered Nov 07 '22 16:11

Nitin


I think it will be helpful to 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];
    }
like image 1
Prasad G Avatar answered Nov 07 '22 17:11

Prasad G


Then you should create your project or update your project universal and change ipad xib setting and autoresize it.

like image 1
vishiphone Avatar answered Nov 07 '22 16:11

vishiphone


I have just copied the old Xib and renamed it as ~ipad at the last. And in the source code instead of 320*480 I have replaced the iPad resolution. And my UI i.e interface builder looks like the iPad and my application is detecting the ipad xib's . Thanks for every one.

like image 1
Perseus Avatar answered Nov 07 '22 16:11

Perseus