zoukankan      html  css  js  c++  java
  • Chapter 17 Autorotation, Popover Controller, and Modal View Controllers

    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

  • 相关阅读:
    针对小程序for循环绑定数据,实现toggle切换效果(交流QQ群:604788754)
    小程序中bindtap绑定函数,函数参数event对数据的处理
    小程序中data数据的处理方法总结(小程序交流群:604788754)
    Power OFF and ON USB device in linux (ubuntu)
    linux控制USB的绑定/解绑
    卡内操作系统COS
    Linux内核:sk_buff解析
    skb_store_bits() 和 skb_copy_bits()
    skb详细解析【转】
    TCP:WireShark分析,序列号Seq和确认号Ack
  • 原文地址:https://www.cnblogs.com/1oo1/p/4004219.html
Copyright © 2011-2022 走看看