我正在设置 UINavigationBar 并且按钮出现问题。当我这样做时:
-(void)addLeftButton:(NSString *)titl
{
UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithTitle:titl style:UIBarButtonItemStyleBordered target:self action:@selector(haikuInstructions)];
self.titleOfNavItem.leftBarButtonItem = button;
}
然后一切都很好。但如果我这样做:
-(void)addLeftButton:(NSString *)titl callingMethod:(NSString *)method
{
UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithTitle:titl style:UIBarButtonItemStyleBordered target:self action:@selector(method)];
self.titleOfNavItem.leftBarButtonItem = button;
}
并在另一个方法中调用该方法,如下所示:
[self addLeftButton:@"Instructions" callingMethod:@"haikuInstructions"];
我得到一个unrecognized selector
错误。关于我做错了什么有什么想法吗?