我第一次使用 QLPreviewController,并遇到了导航栏被状态栏遮挡的问题。以下是我遇到此问题的步骤:
- 点击 UI 以模态方式启动 QLPreviewController。这里工作正常。我看到导航栏和状态栏正确对齐。
- 在 QLPreviewController 中加载的视图中进行点击。导航栏被隐藏。
- 再次在 QLPreviewController 中加载的视图内进行点击。导航栏显示,并被状态栏遮挡。请参见附加的截屏。
你有什么想法,可能出了什么问题吗?
PS:这只发生在横屏模式下,在纵向模式下它可以正常工作。
这是我的代码:
QLPreviewController *aQLPreviewController = [[QLPreviewController alloc] init];
aQLPreviewController.dataSource = self;
aQLPreviewController.delegate = self;
[myViewController presentViewController:aQLPreviewController animated:YES completion:NULL];
QLPreviewController代理方法:
- (NSInteger) numberOfPreviewItemsInPreviewController: (QLPreviewController *)iController {
return 1;
}
- (id <QLPreviewItem>) previewController: (QLPreviewController *) iController previewItemAtIndex: (NSInteger) iIndex {
if (iIndex == 0) {
return self.myURL;
} else {
return nil;
}
}
- (void)previewControllerDidDismiss:(QLPreviewController *)iController {
self.myURL = nil;
}