[英]Is this an iOS 14 UISplitViewController bug?
In my app, I want a three-column UISplitViewController
.在我的应用程序中,我想要一个三列的UISplitViewController
。 I create it like this:我这样创建它:
let svc = UISplitViewController(style: .tripleColumn)
svc.preferredDisplayMode = .twoOverSecondary
svc.setViewController(TestViewController(), for: .primary)
svc.setViewController(TestViewController(), for: .supplementary)
svc.setViewController(TestViewController(), for: .secondary)
svc.primaryBackgroundStyle = .sidebar
This ViewController that I'm presenting is a really simple viewController.我展示的这个 ViewController 是一个非常简单的 viewController。 It doesn't do anything except, present a centered red square.除了显示居中的红色正方形外,它什么都不做。
class TestViewController: UIViewController {
private var redView = UIView()
override func viewDidLoad() {
super.viewDidLoad()
redView.backgroundColor = .red
redView.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(redView)
redView.widthAnchor.constraint(equalToConstant: 30).isActive = true
redView.heightAnchor.constraint(equalToConstant: 30).isActive = true
redView.centerXAnchor.constraint(equalTo: self.view.centerXAnchor).isActive = true
redView.centerYAnchor.constraint(equalTo: self.view.centerYAnchor).isActive = true
}
}
Now, when I run this code, I get the following result.现在,当我运行这段代码时,我得到了以下结果。
As you can see, 2 of the 3 squares are off-center.如您所见,3 个方块中有 2 个偏离中心。 Anyone know, what I'm doing wrong here?任何人都知道,我在这里做错了什么? Or is this a known bug?或者这是一个已知的错误?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.