ios - Segue 后页面 View 大小不正确

标签 ios swift xcode uiviewcontroller segue

我最近将我的 XCode 更新到版本 11.0。自从更新旧项目以来,segues 一直表现得很奇怪。当我以模态方式切换到新页面时,该页面不会填满整个屏幕,而是看似悬停。

这是 View 的图片: https://imgur.com/dAxEr4q

我希望页面能够像升级之前一样占据设备屏幕的整个长度。

预先感谢您的帮助。

最佳答案

这与 iOS 13 中新的默认模式呈现样式有关。
要设置先前的行为,您需要将演示样式更改为全屏。

您可以在 Storyboard 中执行此操作,方法是编辑segue的演示属性并将其从自动设置为全屏:

enter image description here

或者,如果您以编程方式呈现 View Controller ,则可以在呈现之前设置 View Controller modalPresentationStyle,如下所示:

let detailController = /* your View Controller */
detailController.modalPresentationStyle = .overFullScreen
present(detailController, animated: true, completion: nil)

关于ios - Segue 后页面 View 大小不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58116642/

相关文章:

objective-c - 将 UIToolbar 添加到某些文本字段的输入附件 View

ios - 在 Swift 中将自定义 UITableViewCell 共享到多个 UITableViewController

swift - 如何利用 PromiseKit 确保在继续之前检索到查询的对象?

ios - 警告 ITMS-90788 : "Incomplete Document Type Configuration"

ios - 更新启动时调用的 View Controller

javascript - 与 Safari/Chrome 相比,UIWebView 对同一 URL 的行为有所不同

ios - 完全将CoreData上传(备份)到iCloud Drive并根据需要还原

Swift Realm 只改变一个对象的值

objective-c - 在 iOS 中的多个项目之间共享代码的最佳方式

ios - 在Swift中添加Texture后SKView的背景颜色覆盖SKSpriteNode的颜色