2012-04-19 42 views

回答

4

首先聲明你的標籤欄控制器在委託.h文件中

@property (strong, nonatomic) UITabBarController *tabBarController; 

然後宣佈你的根視圖控制器,它在.m文件添加到導航控制器

UIViewController *homeViewController = [[[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil] autorelease]; 
    UINavigationController *navigationcontroller = [[[UINavigationController alloc] initWithRootViewController:homeViewController] autorelease]; 

然後將控制器陣列添加到標籤欄

self.tabBarController = [[[UITabBarController alloc] init] autorelease]; 
    self.tabBarController.viewControllers = [NSArray arrayWithObjects:navigationcontroller,secondViewController and so on, nil]; 
相關問題