ios - Change view controller when user exits app -
hey trying make whenever user presses home button , try returns app, returned initial view controller. there can write app delegate work?
i have tried call function in applicationdidbecomeactive
function:
let storyboard = uistoryboard(name: "main", bundle: nil) let vc = storyboard.instantiateviewcontrollerwithidentifier("homevc") as! uiviewcontroller self.window?.rootviewcontroller?.presentviewcontroller(vc, animated: true, completion: nil)
but error saying view not in hierarchy.
any appreciated!
you want implement applicationdidbecomeactive
method of app's delegate, , programmatically perform segue or dismiss current view controller, depending on navigation setup.
your users might not forced navigation though. general assumption can resume left off.
Comments
Post a Comment