I need to create a circular rating meter in iOS, it’s like a UISlider only curved 3/4 around a circle. I need to rotate a UIImageView (which is the rating needle) around an anchor point, by dragging an invisible touchable handle area the will follow the tip of the needle. The angle of the needle will determine a value.
I am struggling to find an elegant solution. Any thoughts?
Have you tried using the
anchorPointproperty of theUIImageView‘s underlying layer? If you have aCGPointrepresenting the point (in your image view’s coords) around which it is to rotate, you can set the layer’s anchor point:Ensure that the image view’s
centerproperty is set to the appropriate position also, and then apply the rotation transform to rotate about the layer’s anchor point:Remember that you need to import
<QuartzCore/QuartzCore.h>in order to access the layer’s properties.