John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 987 forks source link

navigate From AppDelegate to one of slidemenu item #376

Open minafaw opened 9 years ago

minafaw commented 9 years ago

I try navigate to one of my view items after I get notification

-(void)HandleNavigation{

UIStoryboard *storyboard =[UIStoryboard storyboardWithName:@"Main" bundle:nil];

SWRevealViewController *home = [storyboard instantiateViewControllerWithIdentifier:@"reveal"];
// this my FronViewController 
Home_tableView *root_view = [storyboard instantiateViewControllerWithIdentifier:@"home_view"];

[self.window  makeKeyAndVisible];
self.window.rootViewController = root_view;

[root_view dismissViewControllerAnimated:NO completion:nil];
[root_view presentViewController:home animated:NO completion:nil];

}

I can navigate to my FrontViewController only what I can do to navigate to other view

thank you

quetool commented 8 years ago

You have to instantiate the ViewController you want to show in this way

UIStoryboard *story = [UIStoryboard storyboardWithName:@"YourStoryboard" bundle: nil];

YourViewController *viewController = (YourViewController *)[story instantiateViewControllerWithIdentifier:@"YourViewController"];

SWRevealViewController *controller = (SWRevealViewController *)self.window.rootViewController;

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
[navController setViewControllers:@[viewController] animated:YES];

[controller pushFrontViewController:navController animated:YES];