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!