views:

25

answers:

1

I have a root view which contains a table and a button. When I press the button a view is loaded on top of the root view but keeps my root view visible. The view that appears after the button is pressed is suppose to act as a menu that is scrollable. My problem is that when I want to close the menu that appears.

Im using the [self.view removeFromSuperview] on the subview that appears on top of my root view. When the subview disappears I'm not able to make selections from my table.

How can I get rid of my subview and still keep control of my root view. Also how can I change what my root view displays based on the menu selection I have made. Since my menu is a subview of my root view.

I'm not sure if these things are possible. I have been experimenting but so far I lose control of my root view. I'm able to scroll up and down my table and relaunch the menu subview. But I cannot make any selections from the table. Also I'm unable to change what my root view displays after I have made a choice from the menu.

Please if anyone could shed some light on this issue for me I would greatly appreciate it.

A: 

Okay, I don't fully understand what you are doing, so if my answer is rubbish, please forgive my. As far as I understand, you have a ViewController with another ViewController as a subview. If so, you might very well run into unexpected behavior, since, according to the documentation

Each custom view controller object you create is responsible for managing exactly one screen’s worth of content.

There are some exceptions (e.g. a ViewController inside a TabBarController) but a ViewController inside a ViewController is definitely not the way to go.

So, if you want to show a ViewController after your Button is pressed, show it as a Modal ViewController by using the "presentModalViewController:animated:" method of your "superview". You can make your selection in the ModalView and dismiss it via "dismissModalViewControllerAnimated:"

Phlibbo