大刘的 iOS 自学笔记

presentedViewController

2022-06-23  本文已影响0人  大刘

Created by 大刘 liuxing8807@126.com

presentedViewController

简言之:A.present(B),则A.presentedViewController = B

Apple:
The view controller that is presented by this view controller, or one of its ancestors in the view controller hierarchy.

Declaration

var presentedViewController: UIViewController? { get }

Discussion

When you present a view controller modally (either explicitly or implicitly) using the present(_:animated:completion:) method, the view controller that called the method has this property set to the view controller that it presented. If the current view controller did not present another view controller modally, the value in this property is nil.


presentingViewController

简言之:A.present(B), 则B.presentingViewController = A

The view controller that presented this view controller.

Declaration

var presentingViewController: UIViewController? { get }

Discussion

When you present a view controller modally (either explicitly or implicitly) using the present(_:animated:completion:) method, the view controller that was presented has this property set to the view controller that presented it. If the view controller was not presented modally, but one of its ancestors was, this property contains the view controller that presented the ancestor. If neither the current view controller or any of its ancestors were presented modally, the value in this property is nil.

上一篇下一篇

猜你喜欢

热点阅读