ios - Is MyViewController in the window hierarchy? -
is there way check if myviewcontroller
in window hierarchy ? want know if can present uialertcontroller
:
var alert = uialertcontroller(title: "hello", message: "just fun", preferredstyle: uialertcontrollerstyle.alert) myviewcontroller.presentviewcontroller(alert, animated: true, completion: nil)
the view controller's view
have window
property set if in hierarchy
if myviewcontroller.view.window != nil { // in window hierarchy }
Comments
Post a Comment