gpt4 book ai didi

ios - 呈现小 viewController

转载 作者:搜寻专家 更新时间:2023-11-01 06:16:50 25 4
gpt4 key购买 nike

问题状态:我有两个 viewController

  1. parentViewController (375 * 667)
  2. childViewController (300 * 667)

我想在 Axis (75 * 0) 处呈现 childViewController,如下所示

enter image description here

childViewController 显示在这个 IBAction 上

@IBAction func btnShowVC(_ sender: UIButton) {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let newVC = storyboard.instantiateViewController(withIdentifier: "cvc") as? childViewController
self.present(newVC!, animated: true, completion: nil)
}

但它像这样拉伸(stretch)自己

enter image description here

谁能帮我解决这个问题?谢谢

最佳答案

image here你可以这样试试。

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let newVC = storyboard.instantiateViewController(withIdentifier: "ChildViewController") as? ChildViewController
view.addSubview((newVC?.view)!)
newVC?.view.frame = CGRect(x:75,y:0,width:view.frame.size.width-75,height:view.frame.size.height)
newVC?.view.autoresizingMask = \[.flexibleWidth, .flexibleHeight\]


newVC?.didMove(toParentViewController: self)

关于ios - 呈现小 viewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42920834/

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