我有两个 A 类和 B 类。在 A 类中,我使用:
@interface A : B
在 B 类中,我有这行代码:
self.navigationItem.rightBarButtonItem = [UIBarButtonItem barItemWithImage:[UIImage imageNamed:@"Add-button-normal"]
highlightedImage:[UIImage imageNamed:@"Add-button-active"]
target:self
action:@selector(showPopoverUI:)];
我如何在 A 类中访问这些项目,我尝试了这行代码,但它不起作用:
self.navigationItem.rightBarButtonItem = [UIBarButtonItem barItemWithImage:[UIImage imageNamed:@"Add-button-normal"]
highlightedImage:[UIImage imageNamed:@"Add-button-active"]
target:self.parentViewController
action:@selector(showPopoverUI:)];
我得到了这个错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[B showPopoverUI:]: unrecognized selector sent to class 0x226308'