iOS: Can I override pinch in/out behavior of UIScrollView?

前端 未结 4 1841
轮回少年
轮回少年 2020-12-19 13:21

I\'m drawing a graph on a UIView, which is contained by a UIScrollView so that the user can scroll horizontally to look around the entire graph.

4条回答
  •  执笔经年
    2020-12-19 14:01

    Edsko & bshirley answers are good, but they don't tell where to place the code.

    First, I placed it in viewDidLoad method, but no Pinch Gesture Recognizer was found in the scrollview (maybe because my scrollview is an IBOutlet).

    Then I tried in viewWillAppear or viewDidAppear and the UIPinchGestureRecognizer was here.

提交回复
热议问题