Qiulang
Qiulang

Reputation: 12395

Even with autolayout one xib for all iPhone screen size seems not a good idea

Even with autolayout one xib for all iPhone screen size seems not a good idea or I just can't make it look good on all iPhone devices.The main problem I have is some controls stretching in a way that making the whole view does not look good on other screen size.

Take the following xib as an example, which is rather simple that the controls may only stretch vertically. I start autolayout by defining: (I) vertical space between top and no.1 control (II) vertical space between bottom and no.6 control. (III) Other controls are placed between them.

enter image description here

It looks good on 4 inch screen. But when run on 3.5 inch screen, either the space at no.5 position stretches too narrow (on 4.7 inch screen it stretches too much) or no.2 control is completely overlapped no.1 control like this,

enter image description here

When I add more controls and need to consider the case of horizontal stretching, I just can't make them look good on all devices. Now I end by using one xib for each screen size, which is then not better just using hard-code x,y values and seems to defeat the purpose of using autolayout at all.

So any advice ? Am I doing it wrong with autolayout ?

Upvotes: 0

Views: 88

Answers (1)

bgilham
bgilham

Reputation: 5939

If you simply attempt to make everything fit on the screen things will inevitably get squished. You should consider placing your views inside a UIScrollView. That way the content can scroll vertically as needed.

Upvotes: 0

Related Questions