UIImageView Gestures (Zoom, Rotate) Question

后端 未结 5 1822
陌清茗
陌清茗 2020-11-30 18:28

I would like to make 2 operations to an UIImageView zoom, rotate, I have 2 problems:

A. I make an operation for zoom for ex

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-30 18:38

    Just implement gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: in your delegate.

    I have a UIPinchGestureRecognizer, a UIPanGestureRecognizer and a UIRotationGestureRecognizer set up and I want them all to work at the same time. I also have a UITapGestureRecognizer which I do not want to be recognized simultaneously. All I did was this:

    - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
    {
        if (![gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] && ![otherGestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) {
            return YES;
        }
    
        return NO;
    }
    

提交回复
热议问题