Using UIPinchGestureRecognizer to scale uiviews in single direction

前端 未结 3 1449
悲&欢浪女
悲&欢浪女 2020-12-09 06:55

I would like to know how we can use UIPinchGestureRecognizer to scale UIView in single (x or y) directions alone. Say, if the user moves his two fi

3条回答
  •  伪装坚强ぢ
    2020-12-09 07:29

    Today I am facing the same problem and I found a simple and short way to do this

    - (IBAction)handlePinch:(UIPinchGestureRecognizer *)recognizer
    {
      recognizer.view.transform = CGAffineTransformScale(recognizer.view.transform, recognizer.scale,1);
      recognizer.scale = 1;
    }
    

提交回复
热议问题