gpt4 book ai didi

ios - 添加导致错误的 UIBarButtonItem 数组

转载 作者:行者123 更新时间:2023-11-28 19:51:32 25 4
gpt4 key购买 nike

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI isSystemItem]: unrecognized selector sent to instance 0x7fa5bbd726f0'

我关注了他的solution here ,显然我没有做错。我正在做的是 - 在导航栏的右侧添加两个按钮(栏按钮)。

     UIBarButtonItem *notificationButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Notification.png"]
style:UIBarButtonItemStylePlain target:self action:@selector(notificationAction)];
UIBarButtonItem *searchButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"search"]
style:UIBarButtonItemStylePlain target:self action:@selector(searchAction)];
NSArray *arrNavigationButtons = [NSArray arrayWithObjects:notificationButtonItem,searchButtonItem, nil];
// warning here - Incompatible pointer type.
self.navigationItem.rightBarButtonItem = arrNavigationButtons;

最佳答案

将最后一行更改为 rightBarButtonItems。注意末尾的 s。

关于ios - 添加导致错误的 UIBarButtonItem 数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28968086/

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