2

This is a follow up question to Quicklook/QLPreviewController shows a blank page instead of pdf on ios 8 but works fine on iOS7.

In the last answer's comments, it appears as if someone got nesting a QLPreviewController inside a UINavigationController to work ("we add it to view, which is added to a UInavigationController"), and I'm wondering how that was done.

This all works in iOS7, but in iOS8, I can only see the document when I present the QLPreviewController independently.

This code works in iOS7/8:

QLPreviewController* previewController = [[QLPreviewController alloc] initWithNibName:nil bundle:nil];
previewController.dataSource = self;
previewController.delegate = self;
previewController.modalPresentationStyle = UIModalPresentationFullScreen;
[baseViewController presentViewController:previewController animated:NO completion:nil;

This code works only in iOS7 (in iOS8 I see the nav/toolbars, but a blank screen instead of the doc):

QLPreviewController* previewController = [[QLPreviewController alloc] initWithNibName:nil bundle:nil];
previewController.dataSource = self;
previewController.delegate = self;
previewController.modalPresentationStyle = UIModalPresentationFullScreen;
UINavigationController* navigationController = [[[UINavigationController alloc] init] autorelease];
[navigationController setViewControllers:@[anotherViewController]];
[anotherViewController addChildViewController:previewController];
[anotherViewController.view addSubview:previewController.view];
[baseViewController presentViewController:navigationController animated:NO completion:nil;
Community
  • 1
  • 1
tanya
  • 382
  • 2
  • 11
  • 2
    I was able to work around this issue by following a suggestion here: https://devforums.apple.com/message/1057598#1057598 which was to subclass QLPreviewController and override presentingViewController and return nil. – tanya Oct 20 '14 at 20:27

0 Answers0