导航视图和标签栏导致 iPhone 应用程序退出

发布于 2024-11-07 09:39:12 字数 391 浏览 3 评论 0原文

我目前正在为 iphone 编写一个使用选项卡栏的应用程序。它链接到的视图之一使用导航控制器,以便我可以深入查看用于向用户显示信息的表格视图。一切正常,我可以毫无问题地向下钻取表视图,我可以将当​​前表视图从视图堆栈中推出,并使用导航栏中的后退按钮将堆栈返回到第一个视图。

我遇到的问题是,如果我向下钻取超过 1 个视图级别并按下该视图的选项卡栏按钮,应用程序将退出并且 Xcode 显示 EXC_BAD_ACCESS。

选项卡栏按钮显然试图跳回堆栈中的第一个视图,但它应该这样做吗?

如果是这样,我如何使按钮推送堆栈中的所有内容,或者是否可以从该视图中禁用选项卡栏按钮,尝试再次显示顶视图?

如果用户不小心点击了按钮,整个应用程序返回到第一个视图并不是真正可取的。

任何帮助表示赞赏:)

I'm currently programming an app for iphone that uses the tab bar. One of the views it links to uses a navigation controller so that i can drill down the table view that I am using to display info to the user. It all works OK I can drill down the table view no problem, i can push the current table view off the view stack and return back up the stack to the first view using the back button in the navigation bar.

The problem I have is that if I drill down more than 1 view level and press the tab bar button for that view the application exits and Xcode shows a EXC_BAD_ACCESS.

The tab bars button is obviously trying to jump back to the first view in the stack, but should it be doing this?

If so, how do I make the button push everything from the stack or is it possible to disable the tab bar button from that view trying to show the top view again?

Its not really desirable for the whole app to return to the first view if the user accidentally taps the button.

Any help appreciated :)

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

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

发布评论

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

评论(1

何必那么矫情 2024-11-14 09:39:12

我在试图从选项卡栏链接回的视图对象上设置了自动释放,但没有注意到我也在 dealloc 方法中释放了相同的对象。因此,当我第一次单击该选项卡查看视图时,它仍在内存中,但当返回视图时,其保留计数已设置为零,将其完全从内存中删除。

通过删除 dealloc 方法中的release cal 解决了这个问题。或者删除自动释放也会做同样的事情。

I had an autorelease set on the view object I was trying to link back to from the tab bar and hadn't noticed that I was also releasing the same object in the dealloc method also. So when I viewed the view the first time I clicked the tab it was still in memory but when coming back to the view its retain count had been set to zero removing it from memory altogether.

Solved it by removing the release cal in the dealloc method. Alternatively removing the autorelease would have done the same thing.

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