重定义 UITextField,然后方便在工程中做统一的修改
参考代码:
@implementation UITextField(custom)
-(void)drawRect:(CGRect)rect
{
UIImage* image = [UIImage imageNamed:@"输入框.png"];
image = [image stretchableImageWithLeftCapWidth:image.size.width/2topCapHeight:image.size.height/2];
self.textAlignment = UITextAlignmentLeft;
self.font = c_font_size_14;
self.textColor =[UIColor blueColor];
self.background = image;
self.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, 20)];
self.leftView = paddingView;
[paddingView release];
self.leftViewMode = UITextFieldViewModeAlways;
[super drawRect:rect];
}
@end
THE END !