简体   繁体   中英

Goto a detail view in navigationcontroller storyboard from AppDelegate

I have an App where I use Storyboards .

The first view (navigation controller (initial view)) is connected to a LoginView. When the user is logged in, he sees a modal segue to a Tab controller who is connected to 4 navigation controller views whit their respective UITableViewController´s.

Summary:

NavController - LoginView --> Modal segue --> TabController ---> with 4 tabs - navControllers with Tableviews.

Inside one of those tableviewcontroller there is a DetailView. And when I get my PushNotification in the appDelegate , I need to go to that DetailViewcontroller.

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

Here I get my object, and I can even send that object to the correct viewcontroller to be initialized.

MyDetailViewController *dvc = [[MyDetailViewController alloc] initWithQuestion:object];

But I have googled everywhere to find out how to perform the segue so that spesific detailview gets opened from the pushNotification. The app is staying cool on the view the user left when he left last time.

I need code example of how to do this.

I have tried with initializing of storyboard, setting rootviewcontroller etc but nothing happens (except some errors now and then).

Note: I use "Parse" to give me this notification.

I really appreciate good answers. And I will be gratefull into eternity.

First, maybe you should not alloc/init a view controller that should be instantiated in your storyboard.

As for presenting it, you could either use these navigation controller calls:

popToRootViewControllerAnimated:
pushViewController:animated:

making sure to have only the last one animated.

Or you can present a modal view controller programmatically, similar to the suggestion in this answer .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM