文字列を割り当ててから、@selectorのパラメーターとしてボタンを渡すカスタムボタンがあります。このため、ヘッダーファイルのCustomButtonにプロパティ「name」を配置しました。ただし、文字列をボタンに割り当てると、このエラーが発生します。
'NSInvalidArgumentException', reason: '-[UIButton setName:]: unrecognized selector sent
to instance 0x8484560'
どういう意味ですか?
CustomButton.hのコード:
@interface CustomButton : UIButton
@property (nonatomic, strong)NSString * name;
@end
CustomButton.mのコード:
@synthesize name;
MapViewController.m内
CustomButton *rightButton = [CustomButton buttonWithType:UIButtonTypeInfoLight];
NSLog(@"The button is %@", rightButton);
/*The button is <UIButton: 0x8484560; frame = (0 0; 18 19); opaque = NO; layer =
<CALayer: 0x8484670>>*/
rightButton.name = self.nameTable; //the error is here