KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am subclassing the UIButton, what i want is to set the button type to Round Rect. Button.h @interface Button : UIButton {} - (void)initialize; @end Button.m @implementation Button - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self initialize]; } return self; } -(id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if(self){ [self initialize]; } return self; } - (void)initialize { self.titleLabel.font = [UIFont systemFontOfSize:20]; self.titleLabel.textColor = [UIColor redColor]; self.titleLabel.textAlignment = UITextAlignmentCenter; //[UIButton buttonWithType:UIButtonTypeRoundedRect]; } @end Here i tried [UIButton buttonWithType:UIButtonTypeRoundedRect] but it doesn't work. Can anyone suggest how to make it work? I know in many previous post it has been said that Subclassing UIButton is not recommended, but the fact that in Developer's Docs there is no mention about NOT subclassing it.
Tags (comma-separated)
Save Edits
Cancel