我有三个viewController
第一,第二和第三
从第二到第三我用
Third *third = [[Third alloc]initWithNibName:@"Third" bundle:nil]; [self presentModalViewController:third animated:YES]; [third release];
现在我想从第三到第一回来;然后我在第二个代码中设置viewDidAppear:
[self dismissModalViewControllerAnimated:NO];
但是1秒钟我看到第二个,我不想看它……我该怎么办?
解决方法
您需要首先关闭第三个视图控制器,然后关闭第二个Viewcontroller.当您想要第一个视图控制器时,请执行以下代码.
-(void)goToFirstView{ UIViewController *vc = [self parentViewController]; // UIViewController *vc = [self presentingViewController]; //ios 5 or later [self dismissModalViewControllerAnimated:NO]; [vc dismissModalViewControllerAnimated:YES]; }