How do I programmatically zoom a UIScrollView?

前端 未结 5 1435
臣服心动
臣服心动 2020-12-02 07:55

I\'d like to zoom and unzoom in ways the base class doesn\'t support.

For instance, upon receiving a double tap.

5条回答
  •  悲&欢浪女
    2020-12-02 08:29

    Darren, can you provide a link to said Apple example? Or the title so that I may find it? I see http://developer.apple.com/iphone/library/samplecode/Touches/index.html , but that doesn't cover the zooming.

    The problem I'm seeing after a programatic zoom is that a gesture-zoom snaps the zoom back to what it was before the programatic zoom occurred. It seems that UIScrollView keeps state internally about the zoom factor/level, but I don't have conclusive evidence.

    Thanks, -andrew

    EDIT: I just realized, you are working around the fact that you have little control over UIScrollView's internal zoom factor by resizing and changing the meaning of zoom-factor 1.0. A bit of a hack, but it seems like all Apple's left us with. Perhaps a custom class could encapsulate this trick...

提交回复
热议问题