gpt4 book ai didi

swift - 显示在当前 View 下方而不是上方

转载 作者:行者123 更新时间:2023-11-30 10:49:52 25 4
gpt4 key购买 nike

我试图在另一个呈现的 View Controller 下方呈现一个 View Controller (例如当您打开相机和新闻库时的 WhatsApp)。

我尝试了很多方法,但没有任何效果..

最佳答案

使用 subview Controller 并将添加的 subview Controller 的 View 设置在层次结构的顶部。它将是最顶层的元素,因此该 View 的实际背景将被遮挡,但这就是要走的路。

//code inside UIViewController class
func addViewControllerAtBottom() {
let newVC = NewVCType() //just instantiate it
addChildViewController(newVC)
view.insertSubview(newVC.view, at: 0) //at 0 means it's first rendered, all others will be on top of it
}

关于swift - 显示在当前 View 下方而不是上方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54829500/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com