iOS或去平米分辨率 以及放大模式、高清模式
自己暂时没有遇到这样的问题 搜索资料的时候看到的 觉得不错就收藏下来了
原文:http://blog.csdn.net/xiaoyuanzhiying/article/details/44080667
CGRect rect_screen = [[UIScreen mainScreen]bounds]; CGSize size_screen = rect_screen.size; CGFloat scale_screen = [UIScreen mainScreen].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-04 15:35:06.340 reader[10697:179349] width:640.000000 2015-03-04 15:35:06.341 reader[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)