Sudhakar Tharigoppula
Sudhakar Tharigoppula

Reputation: 2867

Using the same .xib file for both iPhone 4S and iPhone 5

I'm trying to use the same .xib file for two different screen sizes (iPhone 4 and iPhone 5). I've checked other solutions here, but I can't seem to get it working. For example, I've checked How can I create xibs for both iPhone 4 and iPhone 5 using Xocde 4.5

I set the Simulated metrics size to 3.5 and I also check the autoresize. Using autoresize is not an option. I still see a black patch at the bottom of the screen for iPhone5. How can I use one .xib for both iPhone 4 and iPhone 5?

Upvotes: 0

Views: 576

Answers (1)

Gavin
Gavin

Reputation: 8200

Yes, you can use a xib for both screen sizes, you can even use it for the iPad as well, assuming that the design still makes sense on an iPad screen.

If you're using auto layout, then you probably need to set auto layout constraints that define how much space you want between your views and the bottom (and top) of the screen. If you're not using auto layout, you'll want to check your springs and struts, which are the autoresizing options. They should be editable. You'll want to set it so it has fixed space on top and bottom, and variable height.

If this doesn't work for you, then you can try resizing your view in code in the - (void)viewDidLayoutSubviews method of your view controller.

Upvotes: 1

Related Questions