iOS device size is not very sensitive [UIScreen mainscreen

Source: Internet
Author: User

The size of the iOS device is not very sensitive, confusing [[UIScreen mainscreen] bounds] and [UIScreen Mainscreen] applicationframe] The difference, it is always guilty, now under the literacy:

Define a macro:

?
1 #define PrintRect(frame) NSLog(@"X:%f,Y:%f,W:%f,H:%f",frame.origin.x,frame.origin.y,frame.size.width,frame.size.height)

Test Call:

?
12345 NSLog(@"[[UIScreen mainScreen] bounds]"); PrintRect([[UIScreen mainScreen] bounds]);     NSLog(@"[[UIScreen mainScreen] applicationFrame]"); PrintRect([[UIScreen mainScreen]applicationFrame]);

Test results:

?
1234567891011121314151617181920212223242526272829303132333435363738394041424344 //Ipad4retain:2013-07-17 10:08:39.094 IpadSize[191:907] [[UIScreen mainScreen] bounds]2013-07-17 10:08:39.097 IpadSize[191:907] X:0.000000,Y:0.000000,W:768.000000,H:1024.0000002013-07-17 10:08:39.098 IpadSize[191:907] [[UIScreen mainScreen] applicationFrame]2013-07-17 10:08:39.099 IpadSize[191:907] X:0.000000,Y:20.000000,W:768.000000,H:1004.000000//ipadnormal:2013-07-17 10:19:09.886 IpadSize[1223:11303] [[UIScreen mainScreen] bounds]2013-07-17 10:19:09.887 IpadSize[1223:11303] X:0.000000,Y:0.000000,W:768.000000,H:1024.0000002013-07-17 10:19:09.887 IpadSize[1223:11303] [[UIScreen mainScreen] applicationFrame]2013-07-17 10:19:09.888 IpadSize[1223:11303] X:0.000000,Y:20.000000,W:768.000000,H:1004.000000//iphone:2013-07-17 10:15:39.372 IpadSize[1005:11303] [[UIScreen mainScreen] bounds]2013-07-17 10:15:39.373 IpadSize[1005:11303] X:0.000000,Y:0.000000,W:320.000000,H:480.0000002013-07-17 10:15:39.374 IpadSize[1005:11303] [[UIScreen mainScreen] applicationFrame]2013-07-17 10:15:39.374 IpadSize[1005:11303] X:0.000000,Y:20.000000,W:320.000000,H:460.000000//iphone3.5 retain:2013-07-17 10:16:34.145 IpadSize[1043:11303] [[UIScreen mainScreen] bounds]2013-07-17 10:16:34.146 IpadSize[1043:11303] X:0.000000,Y:0.000000,W:320.000000,H:480.0000002013-07-17 10:16:34.147 IpadSize[1043:11303] [[UIScreen mainScreen] applicationFrame]2013-07-17 10:16:34.147 IpadSize[1043:11303] X:0.000000,Y:20.000000,W:320.000000,H:460.000000//iphone4 retain:2013-07-17 10:17:26.562 IpadSize[1083:11303] [[UIScreen mainScreen] bounds]2013-07-17 10:17:26.563 IpadSize[1083:11303] X:0.000000,Y:0.000000,W:320.000000,H:568.0000002013-07-17 10:17:26.564 IpadSize[1083:11303] [[UIScreen mainScreen] applicationFrame]2013-07-17 10:17:26.564 IpadSize[1083:11303] X:0.000000,Y:20.000000,W:320.000000,H:548.000000//IPHONE6 Plus:2015-01-09 19:59:57.905 TripPlusMeIphone[1183:230595] [[UIScreen mainScreen] bounds]2015-01-09 19:59:57.905 TripPlusMeIphone[1183:230595] X:0.000000,Y:0.000000,W:414.000000,H:736.0000002015-01-09 19:59:57.905 TripPlusMeIphone[1183:230595] [[UIScreen mainScreen] applicationFrame]2015-01-09 19:59:57.905 TripPlusMeIphone[1183:230595] X:0.000000,Y:0.000000,W:414.000000,H:736.000000 //iphone62015-01-09 20:02:32.910 TripPlusMeIphone[87512:1855595] [[UIScreen mainScreen] bounds]2015-01-09 20:02:32.911 TripPlusMeIphone[87512:1855595] X:0.000000,Y:0.000000,W:375.000000,H:667.0000002015-01-09 20:02:32.911 TripPlusMeIphone[87512:1855595] [[UIScreen mainScreen] applicationFrame]2015-01-09 20:02:32.911 TripPlusMeIphone[87512:1855595] X:0.000000,Y:0.000000,W:375.000000,H:667.000000

From the log output can be seen, bounds is the full area of the screen, Applicationframe is the app display area, does not include the status bar (height 20, if the status bar is hidden, then the result is the same as bounds)

iOS device size is not very sensitive [UIScreen mainscreen

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.