切换视图退出并尝试再次进入失败

发布于 2024-10-18 22:13:18 字数 757 浏览 8 评论 0原文

我的应用程序有问题。在选项卡控制器中,我有一个登录视图,可以在其中输入网站。如果登录数据正确,视图将切换到另一个视图。工作正常。

现在我的问题是,当我切换选项卡并再次输入登录视图标签并尝试再次登录时,视图不会加载。

这里有什么问题吗?当视图卸载或其他东西时我应该关闭modalviewcontroller吗???

感谢您的帮助, Brush51

编辑1: 嗨,罗宾,在我的登录视图中有一个按钮,它通过以下代码调用网络视图:

ShopWebViewController *shopWVC = [[ShopWebViewController alloc]     initWithNibName:@"ShopWebViewController" bundle:nil];
    shopWVC = [[ShopWebViewController alloc] initWithNibName:@"ShopWebViewController" bundle:nil];
shopWVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[logView  presentModalViewController:shopWVC animated:YES];  

现在,当我退出此日志视图所在的选项卡栏项目并再次输入它时,会出现第一个视图,并且登录/presentmodalviewcontroller 不再工作。 因此,我认为我可能不得不解雇modalviewcontroller,但不知道这是否正确。

i have a problem in my app. in an tabbarcontroller i have a login view where i can enter a website. if the login data is correct the view switches to another view. works fine.

now my problem is, when i switch the tab and enter the login view tag again and try to login again, the view does not load.

Whats here the problem? should i dismissmodalviewcontroller when the view is unload or something else???

thanks for help,
brush51

EDIT1:
hi robin, in my login view is an button which calls a webview whit this code:

ShopWebViewController *shopWVC = [[ShopWebViewController alloc]     initWithNibName:@"ShopWebViewController" bundle:nil];
    shopWVC = [[ShopWebViewController alloc] initWithNibName:@"ShopWebViewController" bundle:nil];
shopWVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[logView  presentModalViewController:shopWVC animated:YES];  

And now when i exit the tabbar item where this logview is and enter it again, then the first view appears and the login/presentmodalviewcontroller doesnt work again.
cause of this i think that i may have to dismissmodalviewcontroller but dont know if this is right or not.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瑶笙 2024-10-25 22:13:18

当您点击登录按钮时:

ShopWebViewController *shopWVC = [[ShopWebViewController alloc] initWithNibName:@"ShopWebViewController" bundle:nil];
shopWVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:shopWVC animated:YES];
[shopWVC release];

然后在刚刚以模态方式呈现的视图控制器中,代码中的某个位置(也许登录成功时?)您需要使用以下命令将其关闭

[[self parentViewController] dismissModalViewControllerAnimated:YES];

When you hit the login button:

ShopWebViewController *shopWVC = [[ShopWebViewController alloc] initWithNibName:@"ShopWebViewController" bundle:nil];
shopWVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:shopWVC animated:YES];
[shopWVC release];

Then in your view controller that has just been presented modally, somewhere in your code (perhaps when login is successful?) you need to dismiss it with

[[self parentViewController] dismissModalViewControllerAnimated:YES];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文