Я хотел бы подклассом UIButton
добавить некоторые свойства, которые мне нужны (а не методы... только свойства).
Здесь код моего подкласса:
//.h-----------------------
@interface MyButton : UIButton{
MyPropertyType *property;
}
@property (nonatomic,retain) MyPropertyType *property;
@end
//.m--------------------------
@implementation MyButton
@synthesize property;
@end
И вот как я использую класс:
MyButton *btn = ((MytButton *)[MyButton buttonWithType:UIButtonTypeRoundedRect]);
btn.property = SomeDataForTheProperty;
Откуда я получаю эту ошибку:
-[UIRoundedRectButton setProperty:]: unrecognized selector sent to instance 0x593e920
Таким образом, из ButtonWithType
я получаю a UIRoundedRectButton
и (Mybutton *)
не может использовать его...
Что я должен сделать, чтобы получить объект MyButton
? -init
единственное решение?
Спасибо!