开发者

How to determine the correct UIScrollView zoomScale with a CATiledLayer

开发者 https://www.devze.com 2023-02-02 02:15 出处:网络
I created a UIScrollView with a CATiledLayer for a 10000x8078 image. Would I place this image in a UIView the zoomScale is always updated according to the contentSize (respectively the size of the i

I created a UIScrollView with a CATiledLayer for a 10000x8078 image.

Would I place this image in a UIView the zoomScale is always updated according to the contentSize (respectively the size of the image).

With CATiledLayer the contentSize now varies according to the tiles in use.

How can I now determine the correct zoomScale of the UISrcollView?

Th开发者_开发知识库anks


What has worked for me, based on the the ZoomingPDFViewer Sample Code, is to keep tabs on the zoom manually the following way in the UIScrollView delegate:

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale
{

    scrollView.scrollEnabled = YES;
    // set the new scale factor for the TiledPDFView
    pdfScale *=scale;
        ....
0

精彩评论

暂无评论...
验证码 换一张
取 消