我将其定义为将度数转换为弧度
#define DEGREES_TO_RADIANS(degrees) ((3.14159 * degrees)/180)然后,我将此代码片段添加到我的viewDidLoad中。我试着在这里创建一条弧线。
UIBezierPath *innerPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(150, 150) radius:75 startAngle:0 endAngle:DEGREES_TO_RADIANS(135) clockwise:YES];
[[UIColor blackColor] setStroke];
[[UIColor redColor] setFill];
innerPath.lineWidth = 5;
[innerPath fill];
[innerPath stroke];然而,当我在模拟器中运行我的应用程序时,弧线并没有出现。我哪里错了?
发布于 2012-08-17 15:18:28
首先,使用M_PI而不是3.14159。
其次,您需要在视图的drawRect:方法中进行绘制。有关UIKit drawing model的更多详细信息,请阅读。
https://stackoverflow.com/questions/12001379
复制相似问题