如何在CALayer中获取CGPoint的绝对位置。我需要这个用于精确的像素绘制
编辑:屏幕绝对
答案 0 :(得分:3)
以递归方式测试超级层,直到到达根层:
CGPoint originalPoint = // wherever from you obtain your original point
CALayer *layer = self;
CGPoint point = originalPoint;
while (layer.superlayer)
{
point = [layer convertPoint:point toLayer:layer.superlayer];
layer = layer.superlayer;
}
// here `point' will contain the exact position