How to develop or migrate apps for iPhone 5 screen resolution?

后端 未结 30 3217
醉话见心
醉话见心 2020-11-21 05:48

The new iPhone 5 display has a new aspect ratio and a new resolution (640 x 1136 pixels).

What is required to develop new or transition already existing applications

30条回答
  •  悲哀的现实
    2020-11-21 06:00

    Sometimes (for pre-storyboard apps), if the layout is going to be sufficiently different, it's worth specifying a different xib according to device (see this question - you'll need to modify the code to deal with iPhone 5) in the viewController init, as no amount of twiddling with autoresizing masks will work if you need different graphics.

    -(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    
        NSString *myNibName;
        if ([MyDeviceInfoUtility isiPhone5]) myNibName = @"MyNibIP5";
        else myNibName = @"MyNib";
    
        if ((self = [super initWithNibName:myNibName bundle:nibBundleOrNil])) {
    
    
    ...
    

    This is useful for apps which are targeting older iOS versions.

提交回复
热议问题