gpt4 book ai didi

ios - 带有多个按钮的导航栏

转载 作者:IT王子 更新时间:2023-10-29 08:02:19 25 4
gpt4 key购买 nike

我有一个带有左右按钮的导航栏,我需要在右边的按钮旁边再放一个按钮。有谁知道我该怎么做?这里有一些代码可以提供帮助:

- (id)init {
self = [super initWithStyle:UITableViewStyleGrouped];
if (self) {

_pinArray = [[NSArray alloc]init];
_pinArray = [Data singleton].annotations;

UIBarButtonItem *right = [[UIBarButtonItem alloc]initWithTitle:@"Map"
style:UIBarButtonItemStylePlain
target:self
action:@selector(goToMap:)];
self.navigationItem.rightBarButtonItem = right;

UIBarButtonItem *left = [[UIBarButtonItem alloc]initWithTitle:@"Menu"
style:UIBarButtonItemStylePlain
target:self
action:@selector(goToMenu:)];
self.navigationItem.leftBarButtonItem = left;
self.navigationItem.title = @"My Homes";
}
return self;
}

最佳答案

这很容易:)

https://developer.apple.com/documentation/uikit/uinavigationitem/1624956-rightbarbuttonitems

navigationItem.rightBarButtonItems = [rightA, rightB] // @[rightA, rightB] for ObjC

关于ios - 带有多个按钮的导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14329916/

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