gpt4 book ai didi

ios - swift - 弹出窗口在横向模式下显示不正确

转载 作者:搜寻专家 更新时间:2023-10-31 19:33:42 24 4
gpt4 key购买 nike

Popover 在横向模式下显示时占据整个屏幕,但在纵向模式下它可以正常工作。此外,当我在横向模式下单击弹出窗口外时,它不会消失。

我通过 Storyboard连接了弹出窗口。在 popoverviewcontroller 中,我放置了一个包含按钮的 View 。 popoverviewcontroller的viewdidload()的代码是:

override func viewDidLoad() {
super.viewDidLoad()

self.preferredContentSize = popoverView.frame.size
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

肖像:

enter image description here

景观:

enter image description here

最佳答案

@Jake2Finn 的回答适用于 Swift 4.0

特别需要 trait 参数来修复景观问题:

traitCollection: UITraitCollection

没有它,功能自适应...仅适用于纵向。

关于ios - swift - 弹出窗口在横向模式下显示不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38572681/

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