Open brbgyn opened 9 years ago
Never mind.
Found out that my code above only works to change between view controllers if the menuViewController (the tableViewController) is on the screen.
Now i`m trying to change between views without having the menu on screen.
For anyone with this kind of question, i managed to open the MENU from any location within the app.
Code to call anywhere is
[NSTimer scheduledTimerWithTimeInterval:0
target:[self topViewController] selector:@selector(presentMenuViewController) userInfo:nil repeats:NO];
Set the topViewController (will be the REFrostedViewController)
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}
if ([rootViewController.presentedViewController isMemberOfClass:[UINavigationController class]]) {
UINavigationController *navigationController = (UINavigationController *)rootViewController.presentedViewController;
UIViewController *lastViewController = [[navigationController viewControllers] lastObject];
return [self topViewController:lastViewController];
}
UIViewController *presentedViewController = (UIViewController *)rootViewController.presentedViewController;
return [self topViewController:presentedViewController];
}
@brbgyn Hi, were you able to change between view controllers programmatically? If yes, could you please give me a hint. Thank you!
Hi @akmalabbasov ,
I can't, im no longer using REFrostedViewController. =/
Hi @brbgyn, Thank you for reply, did you find any other alternative?
I'm using MMDrawerController. https://github.com/mutualmobile/MMDrawerController It's the best menu controller i've found. My app: http://itunes.apple.com/app/id859955280
@brbgyn, but were you able to switch the viewcontrollers programmatically using MMDrawerController?
Yep:
UIViewController *viewController = [[view alloc]init];
UINavigationController *nav = [[MMNavigationController alloc] initWithRootViewController:viewController];
[self.mm_drawerController setCenterViewController:nav withCloseAnimation:YES completion:nil];
@brbgyn, thanks man, you've saved my day!
Do any one found the solution using REFrostedViewController? I am using Storyboard approach shown in example.
I am also looking for a solution
Edit:
I solved the problem by doing this
[appRootViewController presentMenuViewController];
// the code that changes the view as if you selected a menu option
[appRootViewController hideMenuViewController];
Hi,
I managed to open a specific view of my app using push and the frostedViewController works great. Code in the tableViewController:
The problem is when a second Push is received, this code doesnt work anymore... It only works at the first time it runs. I can't find out why.
Am i loading a new navigation controller above the one that is active ?
Whats the best way to change between View Controllers not using the didSelectRowAtIndexPath method of the tableView ?
Thanks in advance