【发布时间】:2014-03-26 11:37:04
【问题描述】:
我正在尝试将两个操作分配给一个 BarButtonItem,但我的语法 (bad receiver type 'NSInteger' aka 'long') 有问题,我无法编译我的应用程序。这是错误的代码:
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(myAction1)];
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(myAction2)];
我正在使用Xcode 5.1,我的目标是iOS 7.0.
你能帮帮我吗?提前谢谢你。
【问题讨论】:
-
此方法不存在。调用将调用
Action1和Action2的方法 -
你想用两种方法做什么?
-
为什么要调用 2 个动作?它根本不可能。您可以将第二个动作作为第一个动作中的方法调用。或使用 nsnotifications 通知任何已注册通知的人
-
这些答案对您有帮助吗?
-
嗨,JoeFryer,对我有帮助的答案如下所示。
标签: ios uinavigationcontroller uibarbuttonitem