1
votes

I am embedding a QLPreviewController in my own view controller by adding it as a child view controller like this (contentArea is a UIView property that determines which part of the screen the preview should use):

    QLPreviewController* preview = [[QLPreviewController alloc] init];
    preview.dataSource = self;
    preview.delegate = self;
    [self addChildViewController:preview];
    CGFloat w = self.contentArea.frame.size.width;
    CGFloat h = self.contentArea.frame.size.height;
    preview.view.frame = CGRectMake(0, 0,w, h);
    [self.contentArea addSubview:preview.view];
    [preview didMoveToParentViewController:self];
    self.qlPreviewController = preview;

This works so far. However, when I open a PDF, I do not get the page scrubber that is shown on the right side when the QLPreviewController is shown full screen (see screenshot).

Page scrubber shown when presented as modal view controller

Using DCIntrospect I see that there is a special subview of type QLScrubView responsible for this:

...
| <QLScrubView: 0x1274e990; frame = (963 64; 61 704); autoresize = LM+H; layer = <CALayer: 0x1274eb30>>
|   | <QLThumbnailView: 0x11fc6460; frame = (17 329; 32 45); layer = <CALayer: 0x11fcb4b0>>
|   | <QLThumbnailView: 0x11fd45a0; frame = (17 382; 32 45); layer = <CALayer: 0x11fbe830>>
|   | <QLThumbnailView: 0x1274dae0; frame = (9 268; 48 61); layer = <CALayer: 0x1273b860>>
...

However, this scrub view is missing in the embedded use case.

Any ideas how to make this appear?

1
hi Daniel! Any solution on this??Frade
No. We have switched to PSPDFKit since then. Way more flexible, way less pain. But commercial, of course. A free alternative might be github.com/vfr/ReaderDaniel Schneller
thanks, I already know vfr/Reader, but I need a solution for scrolling pages vertically. Don't need many of vfr/Reader features.Frade

1 Answers

0
votes

It displays automatically when you have more than one page. I would guess that there's something wrong with your PDF. Try other PDFs from other sources and see if you get the same problem. I use PDFs all the time and the scrubber shows up just fine.

My other thought is maybe resizing your preview controller is not behaving properly. Try loading the preview controller as a modal view controller (no parent) and see if the scrubber is still hidden.