Zoom level resetting when changing bounds

Salvatore Balzano's Avatar

Salvatore Balzano

02 Aug, 2018 09:56 AM

Hi,

we have the pdf reader view embedded as child view controller of a parent view, along with a custom toolbar.

When the user zooms in, we want the pdf reader view to take all the fullscreen space (like the iBooks app).

But when changing the view bounds, the zoom level is being reset to 1;

So I'm using the following code to set it again to the zoomed level:

  • (void)documentViewController:(MFDocumentViewController *)dvc didEndZoomingAtScale:(float)level { if (level > 1) { self.fullscreenEpaperViewBottomMargin.priority = 900;

    CGRect rect = [self.pdfViewController convertRect:self.epaperView.bounds fromViewToPage:self.pdfViewController.page];
    [self.pdfViewController setPage:self.pdfViewController.page withZoomOfLevel:level onRect:rect];
    

    } else { self.fullscreenEpaperViewBottomMargin.priority = 500; } }

This works, except that the setPage: withZoomOfLevel: method includes an animation, so there's a weird effect of the page quickly going back to zoom level 1 and then to the desired one.

Is there any way to have the setPage: withZoomOfLevel: work without animation?
Or is there any other suggested solution?

Thanks,

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac