开发者

rootview controller in Interface builder?

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.

  1. Expand the Navigation Controller in Interface Builder and click on the View Controller (Root View Controller).
  2. In the properties window first tab, change the XIB name to "SimpleTableViewController" and in the fourth tab set the class to "SimpleTableViewController."
  3. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜