iOS 画虚线

UIImageView *imageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(, , , )];
[self.view addSubview:imageView1]; UIGraphicsBeginImageContext(imageView1.frame.size); //开始画线
[imageView1.image drawInRect:CGRectMake(, , imageView1.frame.size.width, imageView1.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound); //设置线条终点形状 float lengths[] = {,};
CGContextRef line = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(line, [UIColor redColor].CGColor); CGContextSetLineDash(line, , lengths, ); //画虚线
CGContextMoveToPoint(line, 0.0, 20.0); //开始画线
CGContextAddLineToPoint(line, 310.0, 20.0);
CGContextStrokePath(line); imageView1.image = UIGraphicsGetImageFromCurrentImageContext();
上一篇:com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Öйú±ê׼ʱ¼


下一篇:KMP模板及总结