gpt4 book ai didi

ios - 在 iPad 中以模式方式呈现不正确

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

单击下一个按钮(位于购物车 View 中,由于显示的 View 而在图像中隐藏),我以模态方式呈现 View 。在 iPhone 中,看起来像这样......

enter image description here

单击下一个按钮以模态呈现 View 时,这是编写的代码...

let vc = PresentedUserDetailsViewController()
vc.modalPresentationStyle = .custom
present(vc, animated: true, completion: nil)

在呈现的 View PresentedUserDetailsViewController中,我已经初始化了以下内容...

let menuHeight = UIScreen.main.bounds.height / 2
init() {
super.init(nibName: nil, bundle: nil)
modalPresentationStyle = .custom
transitioningDelegate = self
}

但是当我在 iPad Air 2 模拟器中运行时, View 会像这样呈现......

enter image description here

应该怎样做才能使呈现的 View 像在 iPhone 中一样......?

最佳答案

这似乎是自动布局问题。也许您可以首先在常规设置中将设备设置为通用,这样它将像这样全屏显示:

enter image description here我可以看到“来自联系人”按钮没有完全居中在 iPad 屏幕上。也许您在布局中使用了固定值?在这种情况下,您应该使用“容器中水平居中”约束,并且通常设置相对于安全区域的宽度和高度约束。您是否尝试过使用 iPhone 5 等不同的屏幕?您可能还会在那里看到一些问题。

关于ios - 在 iPad 中以模式方式呈现不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50409379/

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