I'm noob in ios development. I need some help. I have custom UIButton with picture "arrow", so I need to rotate this button by pressing and moving finger in +360 gr. and -360 gr., like compass arrow.
Here is code that makes rotation.
-(void)LongPress:(UILongPressGestureRecognizer *)gesture { CGPoint p = [gesture locationInView:self.view]; CGPoint zero; zero.x = self.view.bounds.size.width / 2.0; zero.y = self.view.bounds.size.height / 2.0; CGPoint newPoint; newPoint.x = p.x - zero.x; newPoint.y = zero.y - p.y; CGFloat angle; angle = atan2(newPoint.x, newPoint.y); self.myButton.transform = CGAffineTransformRotate(CGAffineTransformIdentity, angle); }