[英]UIStackView's labels with emoji characters are not rendered properly when filled proportionally and horizontal axis after device rotates
I have UIStackView
with two UIlabels
with vertical axis and fill proportionally distribution and alignment center . 我有UIStackView
两个UIlabels
具有垂直轴和填充比例分布和对准中心 。 One of them contains emoji characters. 其中之一包含表情符号字符。
This is how it looks in portrait mode: 这是在纵向模式下的外观:
When device rotates, then I change axis to horizontal , and alignment to first baseline . 当设备旋转时,我将轴更改为水平 ,然后将其对齐至第一个基线 。 This is how it looks after rotating: 旋转后的外观如下:
When label doesn't contain emoji characters everything is fine: 当标签不包含表情符号字符时,一切都很好:
Where is the source of the problem? 问题的根源在哪里?
Make sure that one of the constraints on the label with the emoji is "height". 确保带有表情符号的标签上的约束之一是“高度”。 If one of the constraints is already "height", try making the height of the larger. 如果约束之一已经是“高度”,请尝试将其高度设置得更大。
The answer is in the following method, which should be added to controller: 答案在于以下方法,应将其添加到控制器中:
override func traitCollectionDidChange(previousTraitCollection: UITraitCollection?) {
view.layoutSubviews()
view.layoutIfNeeded()
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.