+ (UIImageView *)createWireImageX:(CGFloat)x Y:(CGFloat)y Width:(CGFloat)width Height:(CGFloat)height Color:(UIColor *)color
{
// height = 10;
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(x, y, width, height)];
UIGraphicsBeginImageContext(imageView.frame.size); //开始画线
[imageView.image drawInRect:CGRectMake(0, 0, imageView.frame.size.width, imageView.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound); //设置线条终点形状
CGFloat lengths[] = {10,3};
CGContextRef line = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(line, color.CGColor);
CGContextSetLineDash(line, 0, lengths, 2); //画虚线
CGContextMoveToPoint(line, 0.0, 20); //开始画线
CGContextAddLineToPoint(line, SCREEN_WIDTH, 20.0);
CGContextStrokePath(line);
imageView.image = UIGraphicsGetImageFromCurrentImageContext();
return imageView;
}
{
// height = 10;
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(x, y, width, height)];
UIGraphicsBeginImageContext(imageView.frame.size); //开始画线
[imageView.image drawInRect:CGRectMake(0, 0, imageView.frame.size.width, imageView.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound); //设置线条终点形状
CGFloat lengths[] = {10,3};
CGContextRef line = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(line, color.CGColor);
CGContextSetLineDash(line, 0, lengths, 2); //画虚线
CGContextMoveToPoint(line, 0.0, 20); //开始画线
CGContextAddLineToPoint(line, SCREEN_WIDTH, 20.0);
CGContextStrokePath(line);
imageView.image = UIGraphicsGetImageFromCurrentImageContext();
return imageView;
}