//画虚线

- (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);

}