我已经以编程方式创建了一个UIStackView
,并在其中放置了UITextView
。UITextView
的数量大于5时,框开始溢出屏幕。这是情况的屏幕截图:
这是代码:
let stackview = UIStackView(arrangedSubviews: letterBoxes)
stackview.axis = .horizontal
stackview.spacing = 10
stackview.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(stackview)
stackview.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
stackview.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
我想念什么?谢谢
还添加这样的前导和尾随约束