我有一个UIImageView,我希望能够调整大小和旋转等。
UIImageView
可以UIGestureRecognizer添加到UIImageView?
UIGestureRecognizer
我想将旋转和捏合识别器添加到UIImageView将在运行时创建的。
如何添加这些识别器?
检查userInteractionEnabled是否YES在UIImageView. 然后你可以添加一个手势识别器。
userInteractionEnabled
YES
imageView.userInteractionEnabled = YES; UIPinchGestureRecognizer *pgr = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)]; pgr.delegate = self; [imageView addGestureRecognizer:pgr]; [pgr release]; : : - (void)handlePinch:(UIPinchGestureRecognizer *)pinchGestureRecognizer { //handle pinch... }