单击导航控制器中的后退按钮时应用程序崩溃

发布于 2024-12-22 15:50:22 字数 300 浏览 3 评论 0原文

我的视图控制器(导航控制器)中有一个表。它包含 5 行。当我单击第三行时,一个新的视图控制器被推入堆栈。这个新控制器还包含一个表视图,该表视图中的单元格包含文本字段(使用 cell.contentView addSubView: 添加)。单击其中一个文本字段时,会显示一个选择器(使用 textField.inputView)而不是键盘。 现在,在选择器中没有选择任何项目的情况下,我单击后退按钮,然后我的视图就会弹出。但过了一段时间(当我位于根视图控制器上时),应用程序崩溃了。

但是如果我单击文本字段(显示键盘),然后按后退按钮;没有发生崩溃。那么,可能是什么问题?

I have a table in my view controller (navigation controller). It contains 5 rows. When I click on one 3rd row, a new view controller is pushed onto the stack. This new controller also contains a table view and the cells in that table view contains text fields (added using cell.contentView addSubView:). On clicking one of the text field, a picker is shown (using textField.inputView) instead of keyboard.
Now, without selecting any item in picker, I click on back button, then my view gets popped. But after a while (when I am on my root view controller), the app gets crashed.

But If I click on a text field (which is showing keyboard), and then press back button; no crash occurs. So, what might be the problem??

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

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

发布评论

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

评论(2

冰雪梦之恋 2024-12-29 15:50:22

看来你的逻辑有问题。尝试构建和调试并在调试器(运行调试器)调用函数堆栈中查看。

Looks like you have some bug in your logic. Try to Build and debug and see in debugger(run-debugger) stack of calling functions.

夜雨飘雪 2024-12-29 15:50:22

如果您使用指针而不将其初始化为 nil 或任何其他对象,那么您可能最终会访问不属于您的内存。这种类型的代码还会给出 EXC_BAD_ACCESS 错误,这意味着您正在使用不属于您的内存。因此,首先使用断点逐行跟踪代码。

If you use a pointer without initializing it to nil or any other object, you are propably going to end up accessing memory which isn't yours. this type of code will also give an EXC_BAD_ACCESS error , that means you are truing to use memory which is not yours. so first trace your code using break points line by line.

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