You need to define a UIRotationGestureRecognize in the view you want to rotate, and then add a selector method and implement it as follows.
Add this to you viewDidLoad method
UIRotationGestureRecognizer *rotate = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotation:)]; [myUIViewObject addGestureRecognizer:rotate]; [rotate release];
And then we implement the method.
- (void) rotation:(UIRotationGestureRecognize *) sender { CGAffineTransform myTransform = CGAffineTransformMakeRotation(sender.rotation); sender.view.transform = myTransform; }
PS. myUIViewObject can be any UIView object that you want to rotate.
Edit:
You will find a lot of information here:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/49847-how-find-angle-two-points.html
Robin
source share