创建了我自己的按钮子类,我得到 -[UIRoundedRectButton setup]: unrecognized selector sent to instance 0x7c3e600'。
我认为这是因为 buttonWithType 只是返回一个显然不是橙色按钮类型的按钮,但无法弄清楚如何做到这一点!
@implementation OrangeButton
+(id)Create
{
OrangeButton *button = (OrangeButton*)[OrangeButton buttonWithType:UIButtonTypeRoundedRect];
[button setup];
return button;
}
-(void) setup
{
[self setBG];
}
-(void)setBG
{
[self setBackgroundImage:[UIImage imageNamed:@"bg-button-orange.gif"] forState:UIControlStateNormal];
}
@end