ios 获取屏幕分辨率

ios 获取屏幕分辨率

   

//屏幕尺寸

CGRect rect = [[UIScreen mainScreen] bounds];

   CGSize size = rect.size;

   CGFloat width = size.width;

   CGFloat height = size.height;

   NSLog(@"print %f,%f",width,height);

 

//分辨率

CGFloat scale_screen = [UIScreen mainScreen].scale;

width = width*scale_screen,

height = height*scale_screen

NSLog( @"print %f,%f",width,height);//  得到像素
 

你可能感兴趣的:(Objective-c)