-(void)drawRect:(CGRect)rect{ CGContextRef cont = UIGraphicsGetCurrentContext(); CGContextSetStrokeColorWithColor(cont, RGB(238, 234, 252).CGColor); CGContextSetLineWidth(cont, 1); CGFloat lengths[] = {8,5}; CGContextSetLineDash(cont, 0, lengths, 2); //画虚线 CGContextBeginPath(cont); CGContextMoveToPoint(cont, 10*RatioWidth, rect.size.height - 1); //开始画线 CGContextAddLineToPoint(cont, rect.size.width-10*RatioWidth, rect.size.height - 1); CGContextStrokePath(cont); }