views:

196

answers:

2

I have an application with multiple views that contain subviews. I know that you can hide or make visible a view and its subviews by setting the hidden property to YES or NO. However with a number of views, to use the hidden property requires keeping track of what view is being displayed. I thought I could use sendSuBViewToBack: to hide a view and moveSubViewToFront to make it visible. However, these methods appear to only act on the specific subview and not its child subviews. For example, a view with a couple of labels on it, when sent to the back, the labels remain visible.

Is there any way to make this behavior work besides using the hidden property?

Thanks,

Jim

A: 

I'm not quite sure what exactly you're having trouble with here. As long as you're keeping track of each "container" view (perhaps using a @property), you should be able to show/hide them on demand using a method in your code (which can be as simple as hiding all container views, and then showing the one you desire).

Shaggy Frog
+1  A: 

UIViewController seems like what you're looking for. Or rather, what you should be looking for.

Jared P