我有两个班,在头等舱
- (IBAction)Login:(id)sender {
SampleViewController2 *sampleView = [[[SampleViewController2 alloc] init];
[self presentModalViewController:sampleView animated:YES];
}
在第二课..
- (IBAction)Logout:(id)sender {
[self dismissModalViewControllerAnimated:YES];
}
它说警告尝试从视图控制器中解除..这里有什么问题..
答案 0 :(得分:2)
添加:
if (![[self modalViewController] isBeingDismissed])
[self dismissModalViewControllerAnimated:YES];
做一个简单的谷歌搜索,你说的问题很常见......
答案 1 :(得分:1)
如果当前视图的模态视图被解除,您可以在解雇之前检查它
if (![[self modalViewController] isBeingDismissed]){
[self dismissModalViewControllerAnimated:YES];
}