iOS用貝塞爾曲線 畫虛線 文字

```

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

```

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容