IOS 8 Version information and screen size

Source: Internet
Author: User

original http://www.cnblogs.com/smileEvday/p/iOS8.html

1, UIWindow's bounds

The bounds of Windows before iOS 7 does not change with the direction, but after iOS 8, as the device rotates, window.bounds.size.width and window.bounds.size.height change accordingly.

To do a very simple test, the code is as follows:

-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions {//Override point for customization after application launch.[[Nsnotificationcenter defaultcenter] addobserver:self selector: @selector (orientationchanged :) name:uideviceorientationdidchangenotificationObject: nil]; returnYES;}- (void) Orientationchanged: (nsnotification*) Noti {uideviceorientation orientation=[Uidevice currentdevice].orientation; NSString*orientationdes =Nil; Switch(orientation) { CaseUideviceorientationlandscapeleft:orientationdes=@"Uiinterfaceorientationlandscaperight";  Break;  CaseUideviceorientationlandscaperight:orientationdes=@"Uiinterfaceorientationlandscapeleft";  Break;  CaseUideviceorientationportrait:orientationdes=@"uiinterfaceorientationportrait";  Break;  CaseUideviceorientationportraitupsidedown:orientationdes=@"Uiinterfaceorientationportraitupsidedown";  Break; default: Orientationdes=@"";  Break; } NSLog (@"System ver:%@, \rorientaion:%@, \rwindow bounds:%@", [Uidevice currentdevice].systemversion, Orientationdes, Nsstringfromcgrect (Self.window.bounds));} 

The sample code is simple, create a new project, and then add the above code directly in the delegate.

Running results on IOS 8 are:

 the- .-Geneva  the: -:32.016svios8[4143:61114] System ver:8.0, orientaion:uiinterfaceorientationlandscaperight, window bounds: {{0,0}, { the,480}} the- .-Geneva  the: -:34.788svios8[4143:61114] System ver:8.0, orientaion:uiinterfaceorientationportrait, window bounds: {{0,0}, {480, the}} the- .-Geneva  the: -:35.791svios8[4143:61114] System ver:8.0, Orientaion:uiinterfaceorientationlandscapeleft, window bounds: {{0,0}, { the,480}} the- .-Geneva  the: -:47.468svios8[4143:61114] System ver:8.0, Orientaion:uiinterfaceorientationportraitupsidedown, window bounds: {{0,0}, {480, the}}

IOS 7 and previous versions run as follows:

 the- .-Geneva  the: the:00.527svios8[4380: 70b] System ver:7.0.3, orientaion:uiinterfaceorientationlandscaperight, window bounds: {{0,0}, { the,480}} the- .-Geneva  the: the:00.895svios8[4380: 70b] System ver:7.0.3, orientaion:uiinterfaceorientationportrait, window bounds: {{0,0}, { the,480}} the- .-Geneva  the: the:01.225svios8[4380: 70b] System ver:7.0.3, Orientaion:uiinterfaceorientationlandscapeleft, window bounds: {{0,0}, { the,480}} the- .-Geneva  the: the:11.004svios8[4380: 70b] System ver:7.0.3, Orientaion:uiinterfaceorientationportraitupsidedown, window bounds: {{0,0}, { the,480}}

By contrast, we can see clearly the changes in UIWindow's policy when dealing with rotations in iOS 8, although there are bugs in the existing project layout due to different versions of the previous version, but you can see that the processing in iOS 8 is more in line with our expectations, and we get the width in vertical < height, in the horizontal is width > height, which is consistent with the principle of WYSIWYG.

IOS 8 Version information and screen size

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.