iOS:关闭两个viewController
问题描述:
我有三个viewController
I have three viewController
第一,第二和第三
从第二个打开我使用的第三个
from Second to open Third I use
Third *third = [[Third alloc]initWithNibName:@"Third" bundle:nil];
[self presentModalViewController:third animated:YES];
[third release];
现在我想从第三回到第一;然后我在第二个代码中设置viewDidAppear:
Now I want return from third to first; then I set in viewDidAppear in second this code:
[self dismissModalViewControllerAnimated:NO];
但是1秒钟我看到了Second,我不想看它……我该怎么办?
but for 1 second I see Second and I don't want watch it...how can I do?
答
您需要先关闭第三个视图控制器,然后再关闭第二个Viewcontroller.当您想成为第一个视图控制器时,请执行以下代码.
You need to dismiss third view controller first and then second Viewcontroller. Do the following code when you want to go first view controller.
-(void)goToFirstView{
UIViewController *vc = [self parentViewController];
// UIViewController *vc = [self presentingViewController]; //ios 5 or later
[self dismissModalViewControllerAnimated:NO];
[vc dismissModalViewControllerAnimated:YES];
}