I have this subclass of UITextField
and I would like to set a property as background color, border etc of UITextField
. I don't know, if I use right method, because when I use this class for a UItextField
, the UITextField
doesn't change.. In which method I have to declare this properties?
#import "defaultUITextField.h"
@implementation defaultUITextField
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.delegate = self;
[self setBackgroundColor:([UIColor redColor])];
UIColor *borderColor = [UIColor colorWithRed:233.0/255.0 green:233.0/255.0 blue:233.0/255.0 alpha:233.0/255.0];
self.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, 20)];
self.leftViewMode = UITextFieldViewModeAlways;
self.layer.borderColor = [borderColor CGColor];
self.layer.borderWidth = 1.0f;
}
return self;
}
@end