Hiding the markup bar in QLPreviewController on iOS 10
Asked Answered
R

1

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

Resendez answered 10/4, 2017 at 8:40 Comment(1)
It's been more than 4 years and still no answer(s). ;(Unduly
M
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;
}
Mores answered 16/1, 2023 at 9:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.