ios - How to push to one view Controller from push Notification and then pop from that View Controller to Another View Controller? -
i using push notification in based on response code push notification push 2 other view controllers. problem not using storyboard segues push other view controllers. instead use code
let notificationdeatilsvc = self.storyboard?.instantiateviewcontrollerwithidentifier("notificationdeatilsvc") as? notificationdeatilsvc self.navigationcontroller?.pushviewcontroller(notificationdeatilsvc!,animated:true)
so whenever want go previous view controller use code
self.navigationcontroller?.popviewcontrolleranimated(true)
so how in notification function. tried following in func application(application: uiapplication, didreceiveremotenotification userinfo: [nsobject : anyobject], fetchcompletionhandler completionhandler: (uibackgroundfetchresult) -> void)
did't work.
let homevc = storyboard.instantiateviewcontrollerwithidentifier("homeviewcontroller") as? homeviewcontroller self.window?.rootviewcontroller = homevc let bidding2viewcontroller = storyboard.instantiateviewcontrollerwithidentifier("bidding2viewcontroller") as? bidding2viewcontroller let notificationdeatilsvc = storyboard.instantiateviewcontrollerwithidentifier("notificationdeatilsvc") as? notificationdeatilsvc if( responsecode == 100) { bidding2viewcontroller?.h = jsonresult?.objectforkey("h")?.integervalue bidding2viewcontroller?.a = jsonresult?.objectforkey("a")?.integervalue homevc!.navigationcontroller!.pushviewcontroller(bidding2viewcontroller!, animated: true) } else if(responsecode == 101) { homevc!.navigationcontroller!.pushviewcontroller(notificationdeatilsvc!, animated: true) }
i using swift 2.0 xcode 7.1.1. in advance.
Comments
Post a Comment