1

UIViewController (UITabBarController を追加したときに xcode によって作成された) のナビゲーション バーにボタンを配置すると、ストーリーボードでは見栄えがよくなりますが、実行すると表示されません。

ただし、次のコードを使用してボタンを追加すると問題なく動作します。

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"About"
            style:UIBarButtonSystemItemDone target:nil action:nil];
    self.tabBarController.navigationItem.rightBarButtonItem = rightButton;
}

前もって感謝します。

4

0 に答える 0