I'd like to subclass UIButton
to add some properties that i need (not methods... only properties).
Here the code of my subclass:
//.h-----------------------
@interface MyButton : UIButton{
MyPropertyType *property;
}
@property (nonatomic,retain) MyPropertyType *property;
@end
//.m--------------------------
@implementation MyButton
@synthesize property;
@end
And here how I use the class:
MyButton *btn = ((MytButton *)[MyButton buttonWithType:UIButtonTypeRoundedRect]);
btn.property = SomeDataForTheProperty;
From where i obtain this error :
-[UIRoundedRectButton setProperty:]: unrecognized selector sent to instance 0x593e920
Thus, from ButtonWithType
i obtain a UIRoundedRectButton
and (Mybutton *)
can't cast it...
What i have to do to obtain a MyButton
object ? is -init
the unique solution ?
Thank you!
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…