简体   繁体   中英

iPhone SDK moving a view and its subviews to back

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

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

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM