How to make xib compatible with both iphone 5 and iphone 4 devices

前端 未结 14 1798
执念已碎
执念已碎 2020-11-28 20:39

I am trying to layout my xib so that layout fits in both iphone 5 (4 inches retina) and 3.5 devices.

Because I have to support IOS-5 I cannot use autolayout. I have

14条回答
  •  自闭症患者
    2020-11-28 21:08

    You need not use a different nib for the 3.5 inch and 4 inch devices. Design the app for the 4 inch device and set the AutoResizingMask correctly and it should work correctly.

    In your case just set the AutoResizingMask to

    [view setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth];
    

    The autoresizing mask places the view correctly to its position in both the devices.

提交回复
热议问题