2014-09-06 62 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