标签:des style io os ar for sp art c
Chapter 17 Autorotation, Popover Controller, and Modal View Controllers
1.There are two distinct orientations in iOS: device orientation and interface orientation.
The device orientation represents the physical orientation of the device, whether it is right-side up, upside down, rotated left, rotated right, on its face, or on its back. You can access the device orientation through the UIDevice class’s orientation property.
The interface orientation, by contrast, is a property of the running application. The following list shows all of the possible interface orientations:
UIInterfaceOrientationPortrait The Home button is below the screen
UIInterfaceOrientationPortraitUpsideDown The Home button is above the screen.
UIInterfaceOrientationLandscapeLeft The device is on its side and the home button is to the right of the screen.
UIInterfaceOrientationLandscapeRight The device is on its side and the Home button is to the left of the screen.
When the application’s interface orientation changes, the size of the window for the application also changes. The window will take on its new size and will rotate its view hierarchy. The views in the hierarchy will lay themselves out again according to their constraints.
2. When writing code to respond to a change in orientation, you override the UIViewController method willAnimateRotationToInterfaceOrientation:duration:. The message willAnimateRotationToInterfaceOrientation:duration: is sent to a view controller when the interface orientation successfully changes. The new interface orientation value is in the first argument to this method.
3. When you write code that changes something about a view (like its frame or whether it is hidden) in this method, those changes are animated. The duration argument tells you how long that animation will take. If you are doing some other work on rotation that does not involve views, or you just do not want the views to animate their changes, you can override the willRotateToInterfaceOrientation:duration: method in your view controller. This method gives you the same information at the same time, but your views are not automatically animated.
Additionally, if you want to do something after the rotation is completed, you can override didRotateFromInterfaceOrientation: in your view controller. This method’s argument is the previous interface orientation before the rotation occurred. You can always ask a view controller for its current orientation by sending it the message interfaceOrientation.
4. On the iPhone or iPod touch, a modal view controller takes over the entire screen. This is the default behavior and the only possibility on these devices. On the iPad, you have two additional options: a form sheet style and a page sheet style. You can change the presentation of the modal view controller by setting its modal PresentationStyle property to a pre-defined constant UIModalPresentationFormSheet or UIModalPresentationPageSheet.
5. In addition to changing the presentation style of a modal view controller, you can change the animation that places it on screen. Like presentation styles, there is a view controller property(modalTransitionStyle) that you can set with a pre-defined constant. By default, the animation will slide the modal view controller up from the bottom of the screen. You can also have the view controller fade in, flip in, or appear underneath a page curl. The various transition styles are:
UIModalTransitionStyleCoverVertical slides up from the bottom
UIModalTransitionStyleCrossDissolve fades in
UIModalTransitionStyleFlipHorizontal flips in with a 3D effect
UIModalTransitionStylePartialCurl presenting view controller is peeled up revealing the modal view controller
Chapter 17 Autorotation, Popover Controller, and Modal View Controllers
标签:des style io os ar for sp art c
原文地址:http://www.cnblogs.com/1oo1/p/4004219.html