我正在展示一个QuickLook预览控制器,如下所示:
QLPreviewController *qlController = [[QLPreviewController alloc] init];
qlController.dataSource = self;
qlController.delegate = self;
dispatch_async(dispatch_get_main_queue(), ^{
[rootVC presentViewController:qlController animated:NO completion:nil];
});
我正在将它传递给usdz预览项目。物品一加载到顶部栏中,它就会消失,但效果却不佳。
默认情况下是否可以隐藏顶部栏(以黄色突出显示),使其永远不会显示?
答案 0 :(得分:2)
是的,但是在展示QLPreviewController
之后。以下代码可以隐藏导航栏,但是稍后。
Objective-C:
[self presentViewController:qlController animated:true completion:^{
UINavigationBar *navBar = [[[[[qlController view] subviews] firstObject] subviews] objectAtIndex:1];
[navBar setHidden:true];
}];
快捷键:
self.present(qlController, animated: true) {
if let navigationBar = qlController.view.subviews.first?.subviews[1] as? UINavigationBar {
navigationBar.isHidden = true
}
}