6

I need to use a QLPreviewController in order to open PDF and JPEG documents into my app. I implemented it in this way:

-(void)openQuickLook{
     QLPreviewController *preview = [[QLPreviewController alloc] init];
     preview.currentPreviewItemIndex = 0;
     preview.delegate = self;
     preview.dataSource = self;

     UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:preview];
    [self presentViewController:nav animated:YES completion:nil];
}

#pragma mark - Quicklook

-(NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller{
    return photos.count;
}

-(id<QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index{
    return photos[index];
}

When I call the openQuickLook method, the preview controller is shown with a bottom bar with editing tools - similar to the iOS "Markup" feature. This happens only on JPEG files. The bar is fixed on the screen; I can choose colours and size but I can't draw anything on the image.

I need to remove this bar from the preview view controller, but I haven't found anything about this feature on the web.

iOS QuickLook

Nicola Giancecchi
  • 3,045
  • 2
  • 25
  • 41

1 Answers1

0

Not sure what was going on there back in 2017 but since iOS 13 there is a delegate callback to control whether markup features should be shown on the preview:

- (QLPreviewItemEditingMode)previewController:(QLPreviewController *)controller editingModeForPreviewItem:(id<QLPreviewItem>)previewItem
{
    // Disable editing
    return QLPreviewItemEditingModeDisabled;
}
mangerlahn
  • 4,746
  • 2
  • 26
  • 50