0

我是一名学习型开发人员,一直在努力学习新事物。我正在玩更高级的视图和子视图,目前正在尝试在视图中使用视图。我知道如何使用模态视图,但在这种情况下,我希望两个视图都存在并运行。所以,想象一下 iPad 运行一个未缩放的 iPhone 应用程序,这与我正在尝试做的事情基本相同。我可以很好地加载视图,但是,当我在用户与之交互的视图中使用按钮或任何东西时,应用程序会崩溃。它给出以下错误消息:EXC_BAD_ACCESS(代码=2,地址=0x17)。奇怪的是调试器在这个问题上没有输出。我曾尝试使用委托(您在模态视图中所做的方式),但它并没有改变任何东西。任何帮助深表感谢 :)

4

1 回答 1

1

You can, of course, put many views inside a view.

EXC_BAD_ACCESS means you, or some object, is trying to access an object which has been deallocated.

I can mostly promise you that the issue is not because you are putting a view in a view, that statement and actually doing that is fine.

How you go about doing it, and how you handle everything is a different story.

You didn't provide any code or context as to where and how you are adding a view to a view, which is probably where the issue is arising. Enabling NSZombie as suggested by xlc0212 is a great idea to help diagnose the problem.

Hope this helps

于 2012-06-03T06:58:32.510 回答