[英]UITabBarController added programmatically, but tab bar doesn't display
[英]Tab bar doesn't appear with UITabBarController
您已經重寫了RootViewController
的loadView
方法,並且沒有調用[super loadView]
語句。 但是, UITabBarController
需要通過loadView
方法初始化其tabBar
。 因此,您必須調用[super loadView]
。
- (void)loadView {
[super loadView];
// self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
self.title = @"aFaire";
NSMutableArray *localViewControllersArray = [[NSMutableArray alloc] initWithCapacity:3];
FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
firstViewController.tabBarItem.title = @"First";
[localViewControllersArray addObject:firstViewController];
self.viewControllers = localViewControllersArray;
self.view.autoresizingMask = (UIViewAutoresizingFlexibleHeight);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.