我从对象库中获取ViewController并放置导航控制器,而不是将导航控制器与导航控制器相同.... 但是Tab Bar无法在控制器中显示......
答案 0 :(得分: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];