2014-09-06 64 views
0

我的应用程序在弹出窗口上点击时有一个注销按钮我希望视图控制器(而不是弹出控制器)转到根视图控制器。我创建了Protocol并调用从MyPopoverViewController到MyMainViewController的方法。一切正常。但是,当我使用弹出到根视图控制器使用popToView控制器代码doenst有任何效果。关闭或从弹出窗口弹出到根视图控制器

-(void)LogOut 
{ 
    NSLog(@"This method is called from pop over view controller using Protocol"); 
    [self.navigationController popToRootViewControllerAnimated:NO]; 
} 

enter image description here

enter image description here

+0

'但是,当我使用弹出到根视图控制器它不working.'叫过来视图控制器有什么不行的 – meda 2014-09-06 06:40:21

+0

这行[self.navigationController popToRootViewControllerAnimated:NO];没有做anythinng – iOSDeveloper 2014-09-06 06:42:03

+0

从navigationController打印你viewController,什么来了? – Bhupesh 2014-09-06 06:46:50

回答

1

该方法是从弹出使用Protocol

-(void)LogOut 
{ 
    NSLog(@"LogOut"); 
    [self dismissViewControllerAnimated:YES completion:^{ 
     [self.navigationController popToRootViewControllerAnimated:YES]; 
    }]; 

} 
+0

它没有工作的朋友 – iOSDeveloper 2014-09-06 07:05:54

+1

所以这意味着它的根已经 – meda 2014-09-06 07:38:07