Rotate view from anchor swift

Viewed 469

In my application, I am calculating BMI of a user based on its height and weight. So based on the BMI value I am animating a needle. The issue is that the needle moves off the center and rotates.

CODE:

ivPointer.layer.anchorPoint = CGPoint(x: 0, y: 0.5)  // i have changed the values still its not working properly
let angle = Double((value * Double.pi)/180)
var transform = CGAffineTransform.identity.rotated(by: CGFloat(angle))
0 Answers
Related