views:

547

answers:

1

Hi .. I create an application base on view based Application project . so i have multi view xib files on my app . on the one of the views i want using Navigation Controller . can you help me step by step to create navigation bar on this view ? let's assume my view name is GhazalViewController . when i add Navigation Controller from library , i need delegate #$@%@#@ and so on .... please help me what can i do ? ! :(

A: 

If you're using a UINavigationController, I find it easy to create it programmatically than to do it in IB (actually, I don't like using IB at all, but that's for another post :P).

In your applicationDidFinishLaunching: method (or wherever else you want to add the UINavigationController), just use this (assuming GhazalViewController is the name of your nib and UIViewController subclass, and that navigationController is an instance variable)

GhazalViewController *ghazal = [[GhazalViewController alloc] initWithNibName:@"GhazalViewController" bundle:nil];
navigationController = [[UINavigationController alloc] initWithRootViewController:ghazal];
[ghazal release];