0

In my app I'm opening a pdf using QLPreviewController, which usually appears with a right thumbnail bar in iOS 10. But when I run the app on iOS 11, the thumbnail bar disappeared. I'm using the following code to preview the pdf.

#import <QuickLook/QuickLook.h>

-(void)viewDidLoad
{
   if ([QLPreviewController canPreviewItem:[[NSBundle mainBundle] URLForResource:@"alice" withExtension:@"pdf"]])
    {
        QLPreviewController *previewController = [[QLPreviewController alloc] init];
        previewController.dataSource = self;
        [previewController.view setFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width/1.2, self.view.frame.size.height)];

        [self addChildViewController:previewController];
        [viewQuickLook addSubview:previewController.view];
        [previewController didMoveToParentViewController:self];
    }
}


-(NSInteger) numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller
{
    return 1;
}

- (id <QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index
{
    NSURL *pdfURL = [[NSBundle mainBundle] URLForResource:@"alice" withExtension:@"pdf"];
    return pdfURL;
}

Is it natural in iOS 11?

Also I set my pdf preview screen width to 80%. But the pdf is not fitting to the screen and the content became horizontally scrollable. Any help will be appreciable.

Poles
  • 3,585
  • 9
  • 43
  • 91
  • It's always a good idea to file a radar in the Apple developer portal if you think something has changed for the worse. Small demo projects help illustrate the issue. – Raffael Nov 08 '17 at 10:23
  • I have the same problem! Did you find a solution? – Giorgio Dec 19 '17 at 19:27
  • No. I also posted in apple's developer forum but nobody seems to care – Poles Dec 21 '17 at 01:29

0 Answers0