2013-04-02 53 views
0

解僱我有一個二級一等嘗試從視圖控制器

- (IBAction)Login:(id)sender { 
SampleViewController2 *sampleView = [[[SampleViewController2 alloc] init]; 
    [self presentModalViewController:sampleView animated:YES]; 
} 
在第二類

..

- (IBAction)Logout:(id)sender { 
    [self dismissModalViewControllerAnimated:YES]; 
} 

它警告說,從嘗試視圖控制器駁回..什麼是這裏的問題..

+0

爲什麼這些行動正在從單獨的類觸發,你說是常見的問題......?你應該只有一個類--UIViewController的子類 - 它負責顯示和隱藏'SampleViewController2'。 – bdesham

+0

發佈您收到的實際警告。 – rdelmar

+0

正在進行演示或解散時嘗試從視圖控制器中解僱! –

回答

1

如果您正在解僱當前視圖的模態視圖,您可能會在解僱前檢查它

if (![[self modalViewController] isBeingDismissed]){ 
     [self dismissModalViewControllerAnimated:YES]; 
} 
2

補充一點:

if (![[self modalViewController] isBeingDismissed]) 
     [self dismissModalViewControllerAnimated:YES]; 

做一個簡單的谷歌搜索,

相關問題