iphone - 从presentModalViewController 交换模态视图后面的 View

标签 iphone modalviewcontroller

我正在尝试创建一个在启动时显示常规 View 的应用程序。它充当带有两个按钮的介绍 View ,使用户可以选择签名或注册。单击登录后,我使用presentModalViewController 呈现表单。他们完成此操作后,我想关闭模态视图,并将介绍 View 与常规应用程序的选项卡栏 Controller 交换。

尽管如此,我在让它以动画方式发生时遇到了很多麻烦。我确实设法让模态视图过渡到其下方的新 View ,但随后立即重新显示介绍 View ,我不确定为什么。

在委托(delegate)中我运行这个:

[window addSubview:firstRunController.view];

呈现 View 非常标准

这就是我如何驳回它并获得我上面所说的行为的方式:

QuestionMeAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[self dismissModalViewControllerAnimated:YES];
[delegate.firstRunController.view removeFromSuperview];

最佳答案

如果你通过navigationController维护 View ,你可以通过- (void)setViewControllers:(NSArray *)viewControllersanimated:(BOOL)animated来分配 View Controller 。

我首先通过重新分配导航 Controller 的 View Controller 来交换 View ,然后调用dismissModelViewController以离开当前 View Controller 或导航 View Controller 。

关于iphone - 从presentModalViewController 交换模态视图后面的 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3903101/

相关文章:

ios - XCode 图像尺寸@3

iphone - 传递给drawLayer的上下文是什么:inContext:?

ios - 当推送每个新的 View Controller 时,调整以模态 UIModalPresentationFormSheet 呈现的导航 Controller 的大小

cocoa-touch - 关闭模态视图 Controller 后重新加载 gridView 数据时出现问题

iphone - APNS 只能通过命令行工作

iphone - RestKit 和核心数据整数数组

iphone - 使用iPhone/Android手机写脚本有什么优缺点?

ios - 显示为模态弹出窗口的 UIViewController 的动态高度

ios - 定义模态视图尺寸 ?