iPhone UIImageView pinch zoom

后端 未结 2 592
我寻月下人不归
我寻月下人不归 2021-02-10 17:36

I have been trying to implement pinch zoom/in-out for PhotoView (a UIImageView instance) using CGAffinTransformScale (planing to use rotation so can not count on frames for the

2条回答
  •  野性不改
    2021-02-10 17:51

    An answer from the left-field perhaps, but an alternative might be to place the UIImageView inside a UIScrollView, define a viewForZoomingInScrollView: method on your scroll view delegate, and set the maximumZoomScale/minimumZoomScale properties and you'll have your pinch zooming without needing to implement the calculations to set the transform yourself? I've just done this on a recent project and it worked well.

提交回复
热议问题