views:

61

answers:

1

I have some buttons on a view for navigation and when a user presses them my code inserts the appropriate new view page (xib) under the navigation buttons. Each new view page that I insert as a subview has some buttons that are supposed to pop up a new view over everything, including the navigation buttons. Here's one of my button actions

    pg5 *pg5view = [[pg5 alloc] init]; //alloc and init UIViewController class for the view to be inserted.
    [self.view insertSubview:pg5view.view atIndex:1]; //insert the subview under the menu but above the last subview displayed
    [[[self.view subviews] objectAtIndex:0]removeFromSuperview]; //remove the last subview displayed

The issue here is that my new subview is inserted as a child of the navigation buttons view, so then when I use an action to addsubview from that viewcontroller, the view is added on top of that view controller, but not on top of the buttons because those are in the parent view. How can I solve this?

Thanks!

A: 

Ask the parent view to insert the subview, and code the parent so it knows how to manage swapping views around?

tc.
That code is from the parent which does handle the swapping but the buttons and view that are supposed to go over everything are located in the xibs of those child views.
Hippocrates