iOS 虚线 圆角矩形

2017-08-01  本文已影响0人  warzook

CGRect drawRect = {10,10,SCREEN_WIDTH - 10*2,40};

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextSetLineWidth(context, 1);

CGContextSetStrokeColorWithColor(context, DEFAULT_LINE_COLOR.CGColor);

CGFloat lengths[] = {3,3};

CGContextSetLineDash(context, 0, lengths,2);

UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRoundedRect:drawRect cornerRadius:7];

CGContextAddPath(context, bezierPath.CGPath);

CGContextStrokePath(context);

CGContextClosePath(context);

上一篇 下一篇

猜你喜欢

热点阅读