iOneWay Blog

天道地道,自求我道

QQ:373850874. 欢迎加入。


UIPresentationController

UIPresentationController是在iOS8.0后出现,用来提供高级视图切换功能, 使管理present ViewController的过程变得简单。

重要属性及方法

// presentation(演示)起点的ViewController(只读属性)
   public var presentingViewController: UIViewController { get }

// 要展示的ViewController(只读属性)
   public var presentedViewController: UIViewController { get }

// 演示风格
   public var presentationStyle: UIModalPresentationStyle { get }

// presented和presenting ViewController的祖先视图。
   public var containerView: UIView? { get }

/* presentation过程中的动画视图,必须是presentedViewController.view的祖先视图,或者是
  presentedViewController.view本身.(默认值:presentedViewController.view本身)*/
   public func presentedView() -> UIView?

// 展示动画开始时调用
   public func presentationTransitionWillBegin()
// 展示动画结束后调用
   public func presentationTransitionDidEnd(completed: Bool)
// 消失动画开始时调用
   public func dismissalTransitionWillBegin()
// 消失动画结束时调用
   public func dismissalTransitionDidEnd(completed: Bool)

在iPad的设置页面,可以通过popOver弹出一个UIViewController,这个弹出的可以和用户交互的Controller叫做PresentedViewController,而后面那个被部分遮挡的UIViewController叫做PresentingViewController。
如图:

presentation

最近的文章

如何添加 Quick actions

原文地址:http://iostuts.io/2015/10/08/how-to-add-quick-actions/ 这篇教程介绍了Quick actions是如何工作的,如何创建Quick act…

继续阅读
更早的文章

CGRectInset 和 CGRectOffset

CGRectInset func CGRectInset(_ rect: CGRect, _ dx: CGFloat, _ dy: CGFloat) -> CGRect 返回一个矩形,这个矩形…

继续阅读