1

我想检测 uiimageview 上的拖动和触摸。我怎么做?我需要在图像翻转事件中实现这样的代码。 iOS 4.2:使用块动画翻转图像

4

1 回答 1

1

对于您的图像视图的拖动和触摸,您必须分配 GestureRecognizer

//drag your object
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panDetected:)];
[self.imageSubVw addGestureRecognizer:panRecognizer];

// scale your object
UIPinchGestureRecognizer *pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchDetected:)];
[self.imageSubVw addGestureRecognizer:pinchRecognizer];

// rotate your object
UIRotationGestureRecognizer *rotationRecognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotationDetected:)];
[self.imageSubVw addGestureRecognizer:rotationRecognizer];

panRecognizer.delegate = self;
pinchRecognizer.delegate = self;
rotationRecognizer.delegate = self;
于 2012-09-11T05:12:58.133 回答