CGRect rect_screen = [[UIScreenmainScreen]bounds];
CGSize size_screen = rect_screen.size;
CGFloat scale_screen = [UIScreenmainScreen].scale;
CGFloat width = size_screen.width*scale_screen;
CGFloat height = size_screen.height*scale_screen;
NSLog(@"width:%f",width);
NSLog(@"height:%f",height);
2015-03-0415:35:06.340reader[10697:179349]width:640.000000
2015-03-0415:35:06.341reader[10697:179349]height:1136.000000
上述情况在iphone6和iPhone6 Plus的缩放模式下,和iPhone5S获取到的分辨率是一样的。
别忘记iphone 6 6+有放大模式和,正常模式
#define iPhone5 ([UIScreen
instancesRespondToSelector:@selector(currentMode)] ?
CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen]
currentMode].size) : NO)
//放大版的iphone6等于Iphone5的分辨率《求区别办法》
#define iPhone6 ([UIScreen
instancesRespondToSelector:@selector(currentMode)] ?
(CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen]
currentMode].size) || CGSizeEqualToSize(CGSizeMake(640, 1136),
[[UIScreen mainScreen] currentMode].size)) : NO)
#define iPhone6plus ([UIScreen
instancesRespondToSelector:@selector(currentMode)] ?
(CGSizeEqualToSize(CGSizeMake(1125, 2001), [[UIScreen mainScreen]
currentMode].size) || CGSizeEqualToSize(CGSizeMake(1242, 2208),
[[UIScreen mainScreen] currentMode].size))
: NO)