Hide right thumbnail bar in QLPreviewController
Asked Answered
F

0

6

I'm failed to hide the right thumbnail bar on tap when I add QLPreviewController as a childviewcontroller. I'm using the following code:

#import <QuickLook/QuickLook.h>

-(void)viewDidLoad
{
   if ([QLPreviewController canPreviewItem:[[NSBundle mainBundle] URLForResource:@"myFile" withExtension:@"pdf"]])
    {
        QLPreviewController *previewController = [[QLPreviewController alloc] init];
        previewController.dataSource = self;

        [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:@"myFile" withExtension:@"pdf"];
    return pdfURL;
}

While I'm using the following code I'm able to hide the thumbnail bar on tap.

QLPreviewController *previewController = [[QLPreviewController alloc] init];
previewController.dataSource = self;
[self presentViewController:previewController animated:YES completion:nil];

But I don't want the navigation bar of QLPreviewController.

Faqir answered 27/10, 2017 at 11:40 Comment(1)
Please add a screenshotGuiana

© 2022 - 2024 — McMap. All rights reserved.