iOS:关闭两个viewController [英] IOS: dismiss two viewController

查看:60
本文介绍了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];
 }

这篇关于iOS:关闭两个viewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆