我要給UIButton自定義一個(gè)屬性,我這樣做的MyUIButton.h@interfaceMyUIButton:UIButton{NSString*idx;}@property(nonatomic,retain)NSString*idx;@endMyUIButton.m@implementationMyUIButton@synthesizeidx;@end#import"MyUIButton.h"MyUIButton*btn=((MyUIButton*)[MyUIButtonbuttonWithType:UIButtonTypeRoundedRect]);btn.idx=@"abcd";然后報(bào)錯(cuò)了:-[UIRoundedRectButtonsetIdx:]:unrecognizedselectorsenttoinstance0x816b2a0難道這樣擴(kuò)展屬性不對(duì)么?
UIButton自定義屬性
翻翻過去那場雪
2019-03-29 11:00:55