views:

252

answers:

2

hello,

I'm designing UI for iPhone application.How should i places a UIView object upon a Navigation ViewController?

Suppose viewObj is the UIView object and uiNavControllerObj is Navigation controllet object?what is the syntax to place viewObj onto uiNavControllerObj?

UIView* viewObj;
NavigationController* uiNavControllerObj;

Edited Question :

Can i achieve this by this syntax? 
uiNavControllerObj.view = viewObj;// is this the proper way to achieve 
[rootviewObj addSubview:uiNavControllerObj.view]; 
[uiwindowObj addSubview:rootViewObj];
A: 

this one should help you out http://icodeblog.com/2008/08/03/iphone-programming-tutorial-transitioning-between-views/

zapping
hi.. i'm doing it withour using INterface builder... plz tell me how to do it programitically
suse
A: 

UINavigationControllers don't deal with UIViews, they deal with UIViewControllers.

Typical usage if your UIViewController is the root (first) view controller:

MyRootViewController *myRootViewController = [[MyRootViewController alloc] init];
UINavigationController *navController = [UINavigationController initWithRootViewController:myRootViewController];

UINavigationController uses a stack to keep track of the ViewControllers it manages. If you want to push another onto the stack (for example, drilling down through a Table View Controller), you would do it from inside the View Controller on top of the stack as such:

AnotherViewController *anotherController = [[AnotherViewController alloc] init];
// every view controller has a reference to it's Navigation Controller
[self.navigationController pushViewController:anotherController];

Alternatively, and I'm only putting this because your question isn't very clear, you can overlay a Navigation Controller with a Modal View Controller. Other than that I'm not really sure what else you would mean by putting a view "on top of" a nav controller.

bpapa
Hello bpapa, thanks for your reply, what i meant is, i've created a window object[uiWindowObj] and i'm adding uiNavControllerObj[ViewController] as subView to rootViewObj[of type UIView] and a rootViewObj as subView to window.Then i've created a viewObj[UIView], which i want to add as subview to uiNavControllerObj. I've written the code in the above section. Edited question. plz tel me can i achieve it by doing that. is the syntax proper?
suse
There's no such type as NavigationController. It's UINavigationController. The way to add views to it is in my answer. Take a look at this for more: http://developer.apple.com/IPhone/library/documentation/UIKit/Reference/UINavigationController_Class/Reference/Reference.html
bpapa