gpt4 book ai didi

ios - UINavigationController 添加右键

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:04:59 25 4
gpt4 key购买 nike

我知道这个问题被问过很多次,但我没有找到我的情况:我在主窗口中有 1 个 UINavigationController。主窗口还包含 UITableView。当我选择行时,NavigationController 使用 nib 推送另一个 UIViewController。这个 UIViewController 没有 Navigation Controller ,它里面只包含 UITableView。

这是这个 UIViewController 的截图:

enter image description here

这不是主窗口。主窗口包含带有 UITableView 的 UINavigationController。

这里是问题:

当我在推送的 UIViewController 中时,如何将 UIBarButtonItem 添加到 NavigationItem 中?

最佳答案

UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(saveItem)];

self.navigationItem.rightBarButtonItem = saveButton;
[saveButton release];

将此添加到您的 viewDidLoad 方法中以创建一个保存按钮。

关于ios - UINavigationController 添加右键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7281803/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com