继承textField重写drawRect
- (void)drawRect:(CGRect)rect {
CGContextRefcontext =UIGraphicsGetCurrentContext();
//设置下划线的颜色
CGContextSetFillColorWithColor(context, [UIColorredColor].CGColor);
//设置textField的frame
CGContextFillRect(context,CGRectMake(0,CGRectGetHeight(self.frame) -0.5,CGRectGetWidth(self.frame),0.5));
}
网友评论