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