我正在根据内容更改UIStackview
高度,无论我在stackview中添加什么,有时它显示正确的高度,但有时内容高度显示40和UIStackview
高度显示为0.
if bluetoothDisconnectedBanner.superview == nil {
bannerStackView.addArrangedSubview(bluetoothDisconnectedBanner)
}
bannerStackView.leadingAnchor.constraint(equalTo:viewController.view.leadingAnchor).isActive = true
bannerStackView.trailingAnchor.constraint(equalTo:viewController.view.trailingAnchor).isActive = true
bannerStackView.topAnchor.constraint(equalTo:viewController.view.topAnchor).isActive = true
bannerStackView.layoutIfNeeded()