我使用的是alertHosting,当我从父级撤消rootViewController时我想处理
MAINVIEW ** [父母]
let alertHostingController = UIHostingController(rootView: SettingsView())
alertHostingController.modalPresentationStyle = UIModalPresentationStyle.fullScreen
UIApplication.shared.windows[0].rootViewController?.present(alertHostingController, animated: false)
SETTINGS VIEW ** [Child]
UIApplication.shared.windows[0].rootViewController?.dismiss(animated: true, completion: nil)
我想知道孩子何时被父母解雇...
有什么想法吗?
protocol ChildDelegate: class {
func childWasDismissed()
}
class ChildController: UIViewController {
var delegate: ChildDelegate?
deinit {
delegate?.childWasDismissed()
}
}
类似的东西。或与闭包相同。