1

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?

Daniel Schneller
  • 13,728
  • 5
  • 43
  • 72
  • hi Daniel! Any solution on this?? – Frade Oct 29 '14 at 14:35
  • No. We have switched to PSPDFKit since then. Way more flexible, way less pain. But commercial, of course. A free alternative might be https://github.com/vfr/Reader – Daniel Schneller Oct 29 '14 at 17:13
  • thanks, I already know vfr/Reader, but I need a solution for scrolling pages vertically. Don't need many of vfr/Reader features. – Frade Oct 29 '14 at 17:37

1 Answers1

0

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.

Matt Long
  • 24,438
  • 4
  • 73
  • 99
  • Using the exact same PDF for both cases. Strangely enough, as I said, the whole subview hierarchy is missing for the scrubber. That said, I have solved the problem differently in the meantime, but would still like to understand what's going on. – Daniel Schneller Feb 11 '13 at 08:26