我有一个带有 NSString 类型参数的方法 @selector。当我编译应用程序时出现此错误
No visible @interface for 'UIButton' declares the selector 'addTarget:action:
withObject:forControlEvents
该方法在头文件中声明。这是代码:
-(void)loadDetailListViewController: (NSString *)nameTable{
//......
}
- (MKAnnotationView *)mapView:(MKMapView *)mapview viewForAnnotation:(id
<MKAnnotation>)annotation
{
//.....
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton addTarget:self action: @selector(loadDetailListViewController:)
withObject:self.nameTable forControlEvents:UIControlEventTouchUpInside];
//here the error
//.....
}
不知道括号对不对