SFSafariViewController 在 iphone 上缺少最高位

SFSafariViewController missing top bit on iphoneX

我将色调设为黑色以更好地展示这一点,但是 SFSafariViewController 在 iphoneX 上缺少最高位。我查看了推特,他们的存在。

如果我向下滚动,我可以看到缺少位的网站内容

我在状态栏被隐藏时呈现 SFSafariViewController 时重现了这个错误。

通过将 modalPresentationStyle 配置为 .overCurrentContext 解决了这个问题:

let safari = SFSafariViewController(url: url)
safari.modalPresentationStyle = .overCurrentContext
present(self, animated: true, completion: completion)

提示:如果不配置modalPresentationStyle,Safari 演示文稿将有类似推送的过渡。