【问题标题】:SWRevealViewController - Current FrontviewcontrollerSWRevealViewController - 当前的 Frontviewcontroller
【发布时间】:2016-09-02 11:24:17
【问题描述】:

在我的项目中,我将 SWRevealviewcontroller 用于滑块菜单。当项目处于后台,然后是前台时,我想要当前的前视图对象。

如何从 SWRevealviewcontroller 获取当前的前视图控制器?

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

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

    NSLog(@"front :%@",mainRevealController.frontViewController);
 }

【问题讨论】:

  • 你能把你的故事板场景展示一次吗
  • @Anbu.Karthik 要图片文件吗?
  • ya bro ..........,实际上 kishore 回答工作正常,但假设如果您在非 SWL 视图控制器中,那么它会进入错误视图或被调用每当你去的时候又回到前台'

标签: ios objective-c iphone ios9 swrevealviewcontroller


【解决方案1】:
- (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];
}

当您的应用激活时,将 ViewController 传递给前端,此方法存在于 appdelegate 中

【讨论】:

    猜你喜欢
    • 2015-03-19
    • 1970-01-01
    • 2015-07-19
    • 2015-12-12
    • 2014-06-06
    • 2015-02-03
    • 2014-05-22
    • 2016-02-04
    • 2015-04-16
    相关资源
    最近更新 更多