美文网首页
iOS 虚线 圆角矩形

iOS 虚线 圆角矩形

作者: warzook | 来源:发表于2017-08-01 10:50 被阅读0次

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

相关文章

网友评论

      本文标题:iOS 虚线 圆角矩形

      本文链接:https://www.haomeiwen.com/subject/ggfjlxtx.html