iOS画线段

 1   CGContextRef context = UIGraphicsGetCurrentContext();
 2   //设置线条类型
 3     CGContextSetLineCap(context, kCGLineCapRound);
 4    //设置宽度
 5     CGContextSetLineWidth(context, 1);
 6   //设置颜色
 7     CGContextSetRGBStrokeColor(context, 1, 1, 1, 1); 
 8     CGContextBeginPath(context);
 9   //线条起点
10     CGContextMoveToPoint(context, 5, self.frame.size.height / 2);
11   //线条终点
12     CGContextAddLineToPoint(context, self.frame.size.width - 5, self.frame.size.height / 2); 
13     CGContextStrokePath(context);

 

posted @ 2019-10-15 16:52  洛洛沙  阅读(312)  评论(0)    收藏  举报