全都是这句代码惹的祸:
A.present(B, animated: true, completion: nil)
在 ViewController.swift 中
打印结果为:
结论(1):
self.presentedController 指向的是弹出的 AAAViewController,🐓:
ViewController.presentedController = AAAViewController
ViewController 和 self.presentationController.presentedViewController 指向同一个 viewController,🐓:
ViewController = self.presentationController.presentedViewController
在 AAAViewController.swift 中
打印结果:
结论(2):
self.presentingController 和 self.presentationController?.presentingViewController 指向的是 ViewController,🐔:
self.presentingController = self.presentationController?.presentingViewController = ViewController
self.presentationController?.presentedViewController 指向的是 AAAViewController, 🐔:
self.presentationController?.presentedViewController = AAAViewController
总结:
A . presented B 时,分别创建了管理模态视图的实例: presentationController