iPad:在关闭第一个模态视图控制器后无法显示第二个模态视图控制器

发布于 2024-12-05 09:05:25 字数 504 浏览 0 评论 0原文

您好,我是 iOS 开发新手,我正在开发的应用程序允许用户使用 Web 服务登录服务器,用户登录后,他将获得他允许访问的书籍列表,然后他选择其中之一,然后做他需要做的事情。

所以这是我的问题。主视图上有一个“登录”按钮。单击“登录”按钮后,会弹出一个模式视图,要求他填写用户名/密码。我将主视图控制器设置为委托,以便模态视图控制器可以将凭据传递给主视图控制器。登录信息通过后,主视图控制器将关闭登录视图控制器并连接到服务器以验证用户帐户。作为响应,服务器发回图书对象列表。在这里,我想使用模式视图用书籍列表填充 UITableView 以便用户从中进行选择。因此,在主视图控制器中的 - (void)parserDidEndDocument:(NSXMLParser *)parser 方法中,我放置了代码来生成并显示带有书籍列表的第二个模式视图,但无论我做什么它都不会显示。我知道我确实获得了图书列表,并且我知道填充第二个模式视图的代码已执行,但第二个模式视图只是不显示。

我在这里阅读了一些相关问题,无论我如何忽略第一个模态视图,第二个模态视图根本没有显示。

Hi I am new to iOS development, and my app i am working on is allow users to log in to the server by using web services, and after the user logged in, he will get a list of the books he's allowed to access and then he select one and do what he needs to do after that.

So here is my problem. There is a "Sign In" button on the main view. After he click the button "Sign In", a modal view poped up asking him to fill in his username/password. I set up the main view controller to be the delegate so that the modal view controller can pass the credentials to the main view controller. After the log in information passed, the main view controller will dismiss the sign in view controller and connect to a server to verify user account. As the response, the server send back a list of book objects. Here I want to use a modal view to populate a UITableView with the book list to let user select from. So in the - (void)parserDidEndDocument:(NSXMLParser *)parser method in main view controller, I put the code to generate and show the second modal view with the book list, and it doesn't show no matter what I do. I know I did get the book list and I know the code to populate the second modal view got executed, but the second modal view just not show.

I read some related questions here and no matter how I dismiss the first modal view, the second one was not shown at all.

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

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

发布评论

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

评论(1

窗影残 2024-12-12 09:05:25

实际上我找到了一个解决方案,尽管它根本不是一个漂亮的解决方案。我所要做的就是将我关闭的第一个模态视图的dismissModalViewControllerAnimated 设置为NO,然后我就可以显示第二个模态视图。我看到有人使用计时器,但这对我来说根本不起作用。

Actually I found a solution to it even though it is not a pretty solution at all. All I have to do is just set the dismissModalViewControllerAnimated to NO for the first modal view I dismissed and then I can have my second modal view shown up. I saw somebody used timer but that didn't work for me at all.

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