views:

97

answers:

1

i am having vie controller nib file with its classes .h and .m and i want to add this view as a sub view to my rootview controller innavigation controller

how to add it.. i want a syntax to this .. please help me....

+1  A: 

Here is the typical code that I use to add a new view controller to my navigation controller:

NextViewController *controller = [[NextViewController alloc]
             initWithNibName:@"NextViewController" bundle:nil];
[appDelegate.navController pushViewController:controller animated:YES];
[controller release];   

Substitute in your own view controller class name for NextViewController above, and your own NIB file name in place of "NextViewController" above.

In my applications, the navigation controller is defined and created in my application delegate class, so appDelegate above is arrived at with the following statement:

MyAppDelegate *appDelegate;
appDelegate = [[UIApplication sharedApplication] delegate];

And you would of course substitute your app delegate class name in place of MyAppDelegate.

BP