我要给UIButton自定义一个属性,我这样做的
MyUIButton.h
@interface MyUIButton : UIButton{ NSString *idx; }@property (nonatomic,retain) NSString *idx;@end
MyUIButton.m
@implementation MyUIButton@synthesize idx;@end
#import "MyUIButton.h" MyUIButton *btn = ((MyUIButton *)[MyUIButton buttonWithType:UIButtonTypeRoundedRect]); btn.idx = @"abcd";
然后报错了:
-[UIRoundedRectButton setIdx:]: unrecognized selector sent to instance 0x816b2a0
慕标琳琳
梵蒂冈之花
相关分类