簡體   English   中英

標簽欄未與UITabBarController一起出現

[英]Tab bar doesn't appear with UITabBarController

我對此代碼有疑問http : //pastebin.com/4D6hmAQh

標題欄顯示成功(帶有標題aFaire),但選項卡欄未出現。

如何以編程方式使標簽欄出現?

您已經重寫了RootViewControllerloadView方法,並且沒有調用[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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM