使用CALayers的模拟时钟

时间:2011-01-22 21:18:01

标签: iphone ios calayer

我正在尝试为iPhone制作一个模拟时钟,其中时钟指针会自动更新到当前时间。我还希望钟针是图像,不像这样:http://iphone-dev-tips.alterplay.com/2010/03/analog-clock-using-quartz-core.html。使用CALayers旋转图像/手来创建它的最简单方法是什么?

1 个答案:

答案 0 :(得分:4)

您可能感兴趣的是CALayers的两个属性 - anchorPointtransform。在要围绕其旋转图像的原点处设置锚点,计算旋转角度,从中创建变换矩阵(在适当的轴周围使用CATransform3DMakeRotation)并在图层上设置变换。

It's all explained in detail here

相关问题