i have done in didapplicationfinishing function
tabBarController = [[UITabBarController alloc] init] ;
tabBarController.navigationItem.title = @"News";
SimpleTableViewController *rtbfViewController = [[SimpleTableViewController alloc]
init];
开发者_高级运维 //initWithStyle:UITableViewStyleGrouped];
rtbfViewController.tabBarItem.title = @"News1";
rtbfViewController.tabBarItem.image = [UIImage imageNamed:@"home.png"];;
UINavigationController *table2NavController = [[[UINavigationController alloc] initWithRootViewController:rtbfViewController] autorelease];
[rtbfViewController release];
it works fine .suppose if i have Navigation controller in Interface Builder,how can i set initWithRootViewController in Interface builder?
Yep you can definitely accomplish this with Interface Builder.
- Expand the Navigation Controller in Interface Builder and click on the View Controller (Root View Controller).
- In the properties window first tab, change the XIB name to "SimpleTableViewController" and in the fourth tab set the class to "SimpleTableViewController."
- Optionally, you can connect the SimpleTableViewController to an outlet on your class if you would like.
This sets the root view controller of the navigation controller to be your SimpleTableViewController.
精彩评论