Sunday, June 16, 2013

Get Size and Resolution of iOS Device

In the Example I will show you how you get Actual Pixel Resolution and size of iOS Device by coding.

Just you have to find the Screen size bound and scale.


CGRect rect=[[UIScreen mainScreen] bounds];
    CGFloat scale=[[UIScreen mainScreen] scale];
    
    NSLog(@"Actual Pixel Resolution: width :% f,height :%f",rect.size.width * scale,rect.size.height * scale);
     NSLog(@" Actual Size width :% f,height :%f",rect.size.width ,rect.size.height );

O/P
For retina 4-inch display
Actual Pixel Resolution: width : 640.000000,height :1136.000000
Actual Size width : 320.000000,height :568.000000


No comments:

Post a Comment