视图高度作为模式弹出窗口-Swift

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

在我使用XCode创建的应用中,我创建了一个视图,该视图作为模式弹出窗口打开。我使用了这段代码:

@IBAction func open_view(_ sender: Any) {
    let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
    let VC_test_object = storyBoard.instantiateViewController(withIdentifier: "VC_Test")
    VC_test_object.modalPresentationStyle = .popover;
    self.present(VC_test_object, animated: true, completion: nil)
}

VC_Test是情节提要中的ViewController。结果是:

View

但是,我想管理视图的高度以创建某种菜单。如本示例屏幕截图所示(来自“文档”应用):

Example

我不知道该怎么做。

您能告诉我如何管理弹出窗口的高度吗?

感谢您的帮助。

swift view popup height viewcontroller
1个回答
0
投票

对于您自己的代码版本,此SO链接及其下面的答案是您需要的:Present modal view controller in half size parent controller

但是,我宁愿使用此第三方库:Presentr

© www.soinside.com 2019 - 2024. All rights reserved.