【发布时间】:2017-08-14 11:58:30
【问题描述】:
我正在尝试以给定角度将CGPath 放置在一个圆圈上。路径看起来更像一个矩形。完成路径创建后,我移动到圆心并从中绘制路径。但我想将矩形的左中心与圆的中心对齐,而不是左上角。我想,我应该通过应用一些公式来计算矩形相对于给定角度的原点,我不知道该怎么做。
//My logic to draw the circle goes here
....
//My custom rect drawing logic is inside the CreatePath method
CGPath customRectPath = CreatePath(size);
context.TranslateCTM(center.X, center.Y);//I am sure this is where I am doing it wrong
context.RotateCTM((float)(angle));
context.AddPath(customRectPath);
context.DrawPath(CGPathDrawingMode.EOFill);
图片应该能解释我想说的话。
【问题讨论】:
-
Start here 我相信你可以自己解决。