iOS custom UITextField and carry underline color

outSubviews
{
    [Self the setNeedsDisplay];
}
- (void) the drawRect: (the CGRect) RECT
{
    // Drawing code
    CGContextRef UIGraphicsGetCurrentContext context = ();
    CGContextSetLineWidth (context, 10.0);
    style lines provided //
    CGContextSetLineCap (context, kCGLineCapRound);
    // set to start the line
    CGContextBeginPath (context);
    // set the color
    CGContextSetRGBStrokeColor (context, 1.0, 0, 0, 1.0);
    
    CGContextMoveToPoint (context, 0, 0);
    CGContextAddLineToPoint (context, self.frame.size.width, 0.5 );
    CGContextStrokePath (context); // begin drawing pictures
    CGContextClosePath (context);
}
@end

 

Published 368 original articles · won praise 22 · Views 200,000 +

Guess you like

Origin blog.csdn.net/BianHuanShiZhe/article/details/104134274