2011-07-15 71 views
4

我試圖在iOS中畫一個四分之一圈。在Mac OS中,似乎你可以使用appendBezierPathWithArcWithCenter,但這在iOS中似乎不起作用。是否有iOS的等效appendBezierPathWithArcWithCenter

有誰知道如何在iOS中畫一個四分之一圈?

感謝

+0

想我已經找到了答案... bezierPa thWithArcCenter:radius:startAngle:endAngle:順時針: – beev

回答

3

有兩種等價的iOS,一個用於UIBezierPath,一個用於CGPath

UIBezierPath相當於

UIBezierPath *path = [UIBezierPath bezierPath]; 
[path addArcWithCenter:centerPoint 
       radius:radius 
      startAngle:startAngle 
       endAngle:endAngle 
      clockwise:YES]; 

CGPath相當於

CGMutablePathRef path = CGPathCreateMutable(); 
CGPathAddArc(path, NULL, 
      centerPoint.x, centerPoint.y, 
      radius, 
      startAngle, 
      endAngle, 
      NO); // clockwise 
+1

請記住,您需要將UBezier路徑角度的NSBezierPath角度(以度爲單位)轉換爲弧度。 (degreeAngle *(PI/180)) – MOK9

相關問題