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/