iOS 8 之后新增了 UIPresentationController 控制器,用于所有的界面转场。在以前,popViewController只适用于iPad。 UIPopoverPresentationControllerDelegate -(UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController
其中: •presentationControllerShouldDismiss(_ presentationController: UIPresentationController) -> Bool决定了是否允许通过手势来 dismiss sheet•presentationControllerWillDismiss(_ presentationController: UIPresentationController)用户尝试使用手势取消时的执行此方法 attempToDismiss = attempToDismiss } func presentationControllerShouldDismiss(_ presentationController: UIPresentationController isDisable } func presentationControllerDidAttemptToDismiss(_ presentationController: UIPresentationController
---- 4、UIPresentationController present和dismiss动画如果想在一个中间的viewController进行,则在实现UIViewControllerTransitioningDelegate 协议时,不要实现以上2个返回animator的方法,而是实现以下返回UIPresentationController的方法: // 返回实现 present-dismiss 动效的VC func presentationController , source: UIViewController) -> UIPresentationController?
_setPresentedViewController:] + 84 13 UIKitCore 0x00007fff46a0b105 -[UIPresentationController endAppearanceTransition:] + 196 24 UIKitCore 0x00007fff46a0bf2b __48-[UIPresentationController
Size Class有关,这个类封装了像水平和竖直方向的Size Class等信息,iOS8的UIKit中大多数UI的基础类(包括UIScreen, UIWindow, UIViewController, UIPresentationController UIViewController 和 UIPresentationController(iOS8的新特性,在这儿不做过多介绍)’象为该协议提供默认的实现方法。
在iOS8之后,系统提供了UIPresentationController来代替她,UIPresentationController可以兼容iPhone与iPad。
Size Class有关,这个类封装了像水平和竖直方向的Size Class等信息,iOS8的UIKit中大多数UI的基础类(包括UIScreen, UIWindow, UIViewController, UIPresentationController UIViewController 和 UIPresentationController(iOS8的新特性,在这儿不做过多介绍)’象为该协议提供默认的实现方法。
UIPopoverPresentationControllerDelegate { func adaptivePresentationStyleForPresentationController(controller: UIPresentationController
说第三个小例子之前我们还得熟悉一下这个:UIPresentationController,它提供了四个函数来定义present和dismiss动画开始前后的操作: 1、presentationTransitionWillBegin UIViewControllerAnimatedTransitioning都写在了CustomPresentationController当中,这个CustomPresentationController就是集成与我们前面提到过的UIPresentationController ,这个UIPresentationController前面提到的时候说的什么可以回忆一下,再在代码中去理解: 从初始化方法开始了解,说说我们需要注意的地方: 1、初始化 /** 初始化
说第三个小例子之前我们还得熟悉一下这个:UIPresentationController,它提供了四个函数来定义present和dismiss动画开始前后的操作: 1、presentationTransitionWillBegin UIViewControllerAnimatedTransitioning都写在了CustomPresentationController当中,这个CustomPresentationController就是集成与我们前面提到过的UIPresentationController ,这个UIPresentationController前面提到的时候说的什么可以回忆一下,再在代码中去理解: 从初始化方法开始了解,说说我们需要注意的地方: 1、初始化 /** 初始化
interactionControllerForDismissal:(id <UIViewControllerAnimatedTransitioning>)animator{}; // 这个方法的返回值是UIPresentationController // UIPresentationController提供了四个函数来定义present和dismiss动画开始前后的操作,这个我们在下面再具体的详细说 - (nullable UIPresentationController
interactionControllerForDismissal:(id <UIViewControllerAnimatedTransitioning>)animator; //iOS8后提供的新接口 返回UIPresentationController 处理转场 - (nullable UIPresentationController *)presentationControllerForPresentedViewController:(UIViewController
endAppearanceTransition:] + 232 4 UIKitCore 0x00007fff23e18dda __48-[UIPresentationController 0x00007fff23f47fbc -[UIViewController _endAppearanceTransition:] + 232 4 0x00007fff23e18dda __48-[UIPresentationController
全新的UIPresentationController在实现视图控制器间的过渡动画效果和自适应设备尺寸变化效果(比如说旋转)中发挥了重要的作用,它有效地节省了程序员们的工作量(天地良心啊)。
self-sizing-cells/ UIViewController新增两个方法,用来处理UITraitEnvironment协议,UIKit里有UIScreen,UIViewController,UIView和UIPresentationController
采用了UITraitEnvironment协议的类有:UIScreen、UIWindow、UIViewController、UIPresentationController和UIView。
API提示: 如需在代码中使用模态视图,你可以创建一个 UIPresentationController.