Question

So i have this .xib which is adapted to Retina 3.5-inch Full Screen. When I run it on a iphone 4 it looks good, but when I test it on iphone 5 the view is pushed down. How should one adapt iOS-apps to work with different iphone screen sizes?

Was it helpful?

Solution 2

Put correct autosizing to your view and it's subviews.

OTHER TIPS

Are you sure you did your auto-layout work right? That's normally the cause for xibs looking weird on different screen sizes.

There are many ways to customize your layouts for different screen sizes:

1) Auto-Layout. You basically need to learn how to set up constraints properly and then Xcode will do a lot of work for you. But that also means there aren't any big differences between a 3.5 and a 4 inch display.

2) Different xibs for different screen sizes. You can set up one xib per screen size and then customize it exactly as you like it. That normally leads to having better UIs but also consumes a lot of time. When using different xibs, don't forget to load the right one in your code.

3) Not using Auto-Layout. That's not really a good way if you're not doing custom xibs for each screensize but it will (most likely) prevent Xcode from moving your views in weird ways.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top