user306766
user306766

Reputation:

How to determine the correct UIScrollView zoomScale with a CATiledLayer

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?

Thanks

Upvotes: 0

Views: 1053

Answers (1)

fsaint
fsaint

Reputation: 8759

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;
        ....

Upvotes: 1

Related Questions