swift - Push to UINavigationController from AppDelegate via remote notification -
my initial view controller tab bar controller, in tab controller there several uinavigationcontrollers, in 1 of uinavigationcontrollers modal presented uinavigationcontroller created flow of uiviewcontrollers.
i need respond received remote notification in app delegate pushing 1 of “deepest” parts of view hierarchy.
i can recreate uinavigationcontroller , launch proper uiviewcontroller name, leaves user high , dry no other place go.
is there way user proper flow of navigation?
the way got work, in didreceiveremotenotification method of app delegate:
let roottabbarcontroller = self.window?.rootviewcontroller uitabbarcontroller let mainstoryboard : uistoryboard = uistoryboard(name: "main", bundle: nil) let firstnavigationcontroller = mainstoryboard.instantiateviewcontrollerwithidentifier("firstnavvc") uinavigationcontroller roottabbarcontroller.viewcontrollers![0] = firstnavigationcontroller let vcontrollerforfirstnavcontroller = (roottabbarcontroller.viewcontrollers![0] uinavigationcontroller).topviewcontroller mainviewcontroller let firstdetailsnavcontroller = mainstoryboard.instantiateviewcontrollerwithidentifier("detailsnavcontroller") maindetailsmenunavigationcontroller let detailsvc = firstdetailsnavcontroller.topviewcontroller maindetailsviewcontroller firstnavigationcontroller.presentviewcontroller(firstdetailsnavcontroller, animated: false, completion: nil) let specificinfovc = mainstoryboard.instantiateviewcontrollerwithidentifier("sdetails") specificdetailsviewcontroller firstdetailsnavcontroller.pushviewcontroller(specificinfovc, animated: true)
Comments
Post a Comment