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

后端 未结 30 3163
醉话见心
醉话见心 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 05:54

    You could add this code:

    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
            if ([[UIScreen mainScreen] respondsToSelector: @selector(scale)]) {
                CGSize result = [[UIScreen mainScreen] bounds].size;
                CGFloat scale = [UIScreen mainScreen].scale;
                result = CGSizeMake(result.width * scale, result.height * scale);
    
                if(result.height == 960) {
                    NSLog(@"iPhone 4 Resolution");
                }
                if(result.height == 1136) {
                  NSLog(@"iPhone 5 Resolution");
                }
            }
            else{
                NSLog(@"Standard Resolution");
            }
        }
    

提交回复
热议问题