0

In my project , I used SWRevealviewcontroller for slider menu.and when Project is in background and then Foreground that time i want current front view object.

How to get current front viewcontroller from SWRevealviewcontroller ?

- (void)applicationWillEnterForeground:(UIApplication *)application {

    SWRevealViewController *mainRevealController = [[SWRevealViewController alloc]  init];

    NSLog(@"front :%@",mainRevealController.frontViewController);
 }
Mahipalsinh
  • 123
  • 7

1 Answers1

0
- (void)applicationDidBecomeActive:(UIApplication *)application 
{
    UIWindow *window=[UIApplication sharedApplication].keyWindow;
UIViewController *root = [window rootViewController];

UIStoryboard *storyboard = root.storyboard;
CustomViewController *vcc =(CustomViewController *) [storyboard instantiateViewControllerWithIdentifier:@"storyBoardID"];

[root presentModalViewController:vcc animated:YES];
}

When your app become active pass the ViewController to front ,this method is present inside the appdelegate

Kishore Kumar
  • 4,265
  • 3
  • 26
  • 47