iOS画线(直线,折线,多个线段)
UIImageView *imageView=[[UIImageView alloc] initWithFrame:CGRectMake(5, 44+HEIGHT_ADJUST_IOS7_BAR+5, SCREENSIZE.width-10, 175-49)]
imageView.backgroundColor = [UIColor whiteColor]
self.view.backgroundColor = COLOR_HEX_RGB(0xefefef)
[self.view addSubview:imageView]
[self.view sendSubviewToBack:imageView]
UIGraphicsBeginImageContext(imageView.frame.size)
[imageView.image drawInRect:CGRectMake(0, 0, imageView.frame.size.width, imageView.frame.size.height)]
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapSquare)
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 0.1)
CGContextSetAllowsAntialiasing(UIGraphicsGetCurrentContext(), YES)
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0.6, 0.6, 0.6, 1.0)
CGContextBeginPath(UIGraphicsGetCurrentContext())
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), 15, 95-49)
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), SCREENSIZE.width-15, 95-49)
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), SCREENSIZE.width-15, 135-49)
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), 15, 135-49)
CGContextStrokePath(UIGraphicsGetCurrentContext())
imageView.image=UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()