gpt4 book ai didi

iphone - 关闭和呈现 modalviewcontrollers

转载 作者:行者123 更新时间:2023-11-28 23:14:28 26 4
gpt4 key购买 nike

你好,

我有一个用户登录的应用程序,当登录详细信息正确时,modalviewcontroller 被关闭。关闭 View Controller 后,将调用另一个 View Controller 。这一切都很好,除了事实,当我想切换回我原来的 Controller 时:我的登录 Controller 。我得到以下代码:

此代码在用户登录时调用:

[self dismissModalViewControllerAnimated:YES];
Form *formcontroller1 = [[Form1 alloc] init];
[self presentModalViewViewController:formcontroller1 animated:YES];

用户登录后,有一个注销按钮调用以下代码:

[self dismissModalViewControllerAnimated:YES];
Postform3ViewController *logincontroller = [[Postform3ViewController alloc] init];
[self presentModalViewViewController:logincontroller animated:YES];

点击按钮后,出现如下错误信息:

Postform3[5848:207] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempting to begin a modal transition from to while a transition is already in progress. Wait for viewDidAppear/viewDidDisappear to know the current transition has completed'

我想知道是否有人可以帮我解决这个问题..

最佳答案

实际上,错误消息准确地告诉了您需要做什么。您要关闭一个模态视图 Controller ,但不要等到它被关闭后再尝试呈现另一个。在 View Controller 机制调用 -viewDidDisappear: 之后,您应该稍后呈现第二个 View Controller 。

关于iphone - 关闭和呈现 modalviewcontrollers,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7011590/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com