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