PDFView在导航控制器的根视图中显示时不显示

问题描述 投票:0回答:1

我在XIB中有一个视图控制器,其中包含一个PDFView,我想通过导航栏和工具栏以模态呈现。出现以下情况时,不会出现PDFView:

    let detailVC = BackgroundImageVC(viewModel: viewModel, transparency: transparency, selector: selector)
    present(UINavigationController(rootViewController: detailVC), animated: true)

结果:

Presented in navigation controller

直接显示时出现PDFView,但当然没有导航和工具栏:

    let detailVC = BackgroundImageVC(viewModel: viewModel, transparency: transparency, selector: selector)
    present(detailVC, animated: true)

结果:

Presented as view controller

我在这里想念什么?

[[Swift 5,Xcode 11.3.1]

swift ios13 pdfkit
1个回答
0
投票

您可以尝试将detailVC添加为子视图。

detailVC.center = view.center
detailVC.bounds.size.width = view.bounds.width
detailVC.bounds.size.height = view.bounds.height
view.addSubview(detailVC)
© www.soinside.com 2019 - 2024. All rights reserved.