美文网首页征服iOS
iOS用贝塞尔曲线 画虚线 文字

iOS用贝塞尔曲线 画虚线 文字

作者: JasonEVA | 来源:发表于2016-03-07 09:55 被阅读3298次

```

UIBezierPath *path3 = [UIBezierPath bezierPath];

[path3 moveToPoint:CGPointMake(self.frame.size.width / 2 + 10, i * ROWHEIGHT)];

[path3 addLineToPoint:CGPointMake(self.frame.size.width / 2 + 10, (i + 1) * ROWHEIGHT)];

[path3 setLineWidth:3];

CGFloat dashPattern[] = {3,1};// 3实线,1空白

[path3 setLineDash:dashPattern count:1 phase:1];

[[UIColor colorWithHex:0xeeeeee] setStroke];

[path3 stroke];

文字

NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];//段落样式

style.alignment = NSTextAlignmentCenter;

NSDictionary *dictAttributesCN = @{NSFontAttributeName:[UIFont systemFontOfSize:fontSize_15],NSForegroundColorAttributeName:[UIColor whiteColor],NSParagraphStyleAttributeName:style};

[@"体重(公斤)" drawInRect:CGRectMake(weightUnit.x, weightUnit.y, 100, kWordWidth) withAttributes:dictAttributesCN];

```

相关文章

网友评论

    本文标题:iOS用贝塞尔曲线 画虚线 文字

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