gpt4 book ai didi

iphone - 将 BarButtonItem 添加到 NavigationBar

转载 作者:塔克拉玛干 更新时间:2023-11-01 19:14:21 24 4
gpt4 key购买 nike

我通过 IB 添加了一个 NavigationBar,并试图以编程方式添加一个 UIBarButtonItem.....但它不起作用。

- (void)viewDidLoad { 

UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"Edit"style:UIBarButtonItemStyleBordered target:self action:@selector(EditTable:)];
[self.navigationItem setLeftBarButtonItem:self.addButton];
[super viewDidLoad];
}

最佳答案

尝试这样做:

self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(backButtonTapped:)];

关于iphone - 将 BarButtonItem 添加到 NavigationBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7510445/

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