// The view controller that was presented by this view controller or its nearest ancestor.
@property(nullable, nonatomic,readonly) UIViewController *presentedViewController API_AVAILABLE(ios(5.0));
// The view controller that presented this view controller (or its farthest ancestor.)
@property(nullable, nonatomic,readonly) UIViewController *presentingViewController API_AVAILABLE(ios(5.0));
---------------------A弹B后---------------------
A.presentingViewController (null)
A.presentedViewController B
B.presentingViewController A
B.presentedViewController (null)
---------------------B弹C后---------------------
A.presentingViewController (null)
A.presentedViewController B
B.presentingViewController A
B.presentedViewController C
C.presentingViewController B
C.presentedViewController (null)
常见的问题场景
问题1:业务VC要present出SDK中的功能VC, SDK功能VC要present出子功能VC,当点击SDK中的功能VC的“X”或者子功能VC的“X”,都要让SDK页面完全退出。
简化问题为A present B , B present C 。关闭C时,BC要退出;关闭B时,BC要退出。
对于关闭C时,BC要退出;关闭B时,BC要退出需求可以调用B.presentedViewController dissmiss方法解决。