需要石英2d的一些帮助,这对我来说是全新的。iOS多次绘制相同的形状
基本上我的应用程序需要按照触摸,从中心多次绘制该行。问题是它必须是动态的,线条必须平均分布(类似于从中心开始的章鱼)。我在android上的方式是记住数组中的形状路径,而不是通过旋转坐标系多次绘制它,但我无法弄清楚如何在iOS上执行它。
我的旋转功能
- (void) rotateContext:(int)angle
{
CGContextTranslateCTM(UIGraphicsGetCurrentContext(), self.center.x, self.center.y);
CGContextRotateCTM(UIGraphicsGetCurrentContext(), radians(angle));
CGContextTranslateCTM(UIGraphicsGetCurrentContext(), -self.center.x, -self.center.y);
}
它只是如果我尝试做做它的drawRect(),它旋转所有的路径与它的工作原理。
你能否给我一个解决问题的好方法?
感谢
如果您要使用在屏幕上反复绘制的相同形状,则应该使用CGLayers。 [查看官方文档了解更多信息。](https://developer.apple.com/library/mac/#documentation/graphicsimaging/conceptual/drawingwithquartz2d/dq_layers/dq_layers.html) – Lefteris