Radrider33
Radrider33

Reputation: 557

Using a view within a view causes crashes?

I am a learning developer that is always trying to learn new things. I am playing around with more advanced views and subviews, and am currently trying to use a view within a view. I know how to use modal views, but in this case I want both views to be present and running. So, picture the iPad running an unscaled iPhone app, that is basically the same idea of what I am trying to do. I can get the view to load up just fine, however, when I use buttons or anything inside the views that the user interacts with, the application crashes. It gives the following error message: EXC_BAD_ACCESS (Code=2, Address=0x17). What's weird is that there is no output from the debugger on this issue. I have tried to use a delegate (the way you do in a modal view) and it doesn't change anything. Any help is much appreciated :)

Upvotes: 0

Views: 130

Answers (1)

Benjamin
Benjamin

Reputation: 1862

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

Upvotes: 1

Related Questions