//画虚线
//画虚线
- (void)drawRect:(CGRect)rect {
[super drawRect:rect];
float sizeWidth = rect.size.width;
float sizeHeight = rect.size.height;
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextBeginPath(context);
CGContextSetLineWidth(context, 2.0);
CGContextSetStrokeColorWithColor(context, [UIColor grayColor].CGColor);
CGFloat lengths[] = {10,5};
CGContextSetLineDash(context, 0, lengths,2);
CGContextMoveToPoint(context, 0, 0);
CGContextAddLineToPoint(context, sizeWidth,0);
CGContextAddLineToPoint(context, sizeWidth,sizeHeight);
CGContextAddLineToPoint(context, 0,sizeHeight);
CGContextAddLineToPoint(context, 0,0);
CGContextStrokePath(context);
}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。