在模态视图之上呈现模态视图

时间:2011-12-25 14:31:03

标签: iphone objective-c cocoa-touch

我有一个标签栏应用程序,我在它上面显示一个模态视图,如果用户没有登录则是用户登录视图。

在登录视图中,我有一个注册按钮,应该显示注册视图。

如何在登录视图顶部显示注册视图为presentModalViewController,该视图已在标签栏视图的顶部显示为presentModalViewController

修改 我正在使用此代码为tabBarController显示登录视图

[self.tabBarController presentModalViewController:loginViewController animated:YES];

我尝试了同样的登录视图来显示注册视图,这是我做了但没有用的:

[self.modalViewController presentModalViewController:createAccount animated:YES];

3 个答案:

答案 0 :(得分:2)

您需要做的是在第一个模态视图的顶部显示下一个模态视图(通过在第一个模态视图控制器上调用-presentModalView ...)。然后只需关闭第一个模态视图,第二个视图将与第一个视图一起消失

答案 1 :(得分:2)

如果您想在ModalViewController之上展示loginViewController并且您在loginViewController内,则只需要在self指针上直接调用它。

[self presentModalViewController:createAccount animated:YES];

更新:适用于6.0 +

[self presentModalViewController:createAccount animated:YES completion:nil];

答案 2 :(得分:0)

与第一个相同,使用presentModalViewController。

相关问题