01.
02.
03.
04.
05.
06.
07.
08.
09.
#import "ViewController.h"
10.
11.
@interface
ViewController ()
12.
13.
@end
14.
15.
@implementation
ViewController
16.
17.
- (
void
)viewDidLoad
18.
{
19.
[
super
viewDidLoad];
20.
21.
22.
23.
UIRotationGestureRecognizer
*rotationGesture =[[
UIRotationGestureRecognizer
alloc]
24.
initWithTarget:
self
25.
action:
@selector
(rotationGuestureHandle:)];
26.
[[
self
view] addGestureRecognizer:rotationGesture];
27.
}
28.
29.
-(
void
) rotationGuestureHandle:(
UIRotationGestureRecognizer
*) sender {
30.
31.
NSLog
(@
"Rotation Gesture Handling"
);
32.
33.
UIRotationGestureRecognizer
*rotation = (
UIRotationGestureRecognizer
*)sender;
34.
35.
CGFloat angle = rotation.rotation;
36.
imgView.transform = CGAffineTransformRotate(imgView.transform, angle);
37.
rotation.rotation=0.0;
38.
}
39.
40.
- (
void
)didReceiveMemoryWarning
41.
{
42.
[
super
didReceiveMemoryWarning];
43.
44.
}
45.
46.
- (
void
)dealloc {
47.
[imgView release];
48.
[
super
dealloc];
49.
}
50.
@end