views:

188

answers:

3

Hi people,

how do you add an overlay view that goes over everything. eg over a tab bar controller, and a navigation controller?

thanks

A: 

Find the "top" view in your stack, and add a subview. eg

[self.tabBarController.view addSubview:myView];

The hardest part is finding the topmost view; with a tab bar, it will be its own view.

Paul Lynch
A: 

Add a window. That's what the popup keyboard and UIAlertView do, you can see that in this view dump.

progrmr
+1  A: 

Use a modal view controller. Have a read of this guide:

http://developer.apple.com/iphone/library/featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html

Presenting the view controller itself is easy:

UINavigationController *navigationController = [[UINavigationController alloc]
                         initWithRootViewController:addController];
[self presentModalViewController:navigationController animated:YES];
pheelicks