![](/img/trans.png)
[英]modalPresentationStyle formSheet issues on iphone XR, XS Max
[英]What exactly is the height of modalPresentationStyle - FormSheet on iPad?
iPad上modalPresentationStyle-FormSheet的高度到底是多少? 我写了一行代码来获取self.view的高度,如下所示:
println("Height - modalPresentationStyle FormSheet: \(self.view.frame.size.height)")
经过测试,我得到了以下两个结果:
ModalViewController上没有Formsheet时 ,高度为1024.0
使用FormPresentationStyle上的Formsheet时 ,高度为1024.0 ,这是错误的,因为高度应该小于1024.0
知道这有什么问题吗? 我需要使用formsheet从self.view.frame.size.height获得正确的高度,因为我需要在代码中的某个地方编写公式。 我不需要更改表单的大小。
不要在viewDidLoad
而是在viewDidAppear
内实现println
。
在Storyboard中使用Segue呈现的以下类:Modally Presentation和Presentation:Form Sheet在viewDidLoad
, viewWillAppear
或viewDidAppear
调用时,为同一println
提供不同的结果:
class ViewController2: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
println(view.frame) // (0.0, 0.0, 768.0, 1024.0)
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
println(view.frame) // (0.0, 0.0, 768.0, 1024.0)
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
println(view.frame) // (0.0, 0.0, 540.0, 620.0) // Correct values
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.