当我将QLPreviewController添加为childviewcontroller时,我无法隐藏正确的缩略图栏。我正在使用以下代码:
#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;
}
当我使用以下代码时,我可以隐藏缩略图栏。
QLPreviewController *previewController = [[QLPreviewController alloc] init];
previewController.dataSource = self;
[self presentViewController:previewController animated:YES completion:nil];
但我不想要QLPreviewController的导航栏。