简体   繁体   English

当设备旋转后按比例填充和水平轴时,带有表情符号字符的UIStackView的标签无法正确呈现

[英]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.

相关问题 为什么嵌入的 UIStackView,按比例填充,间距和布局边距会导致约束错误以及如何修复? - Why do embedded UIStackView's, filled Proportionally, with spacing and Layout Margins causes constraint errors and how to fix? 使用UIStackView的轴和实际设备时,Size Class紧凑高度无法正常工作 - Size Class compact height doesn't work properly with UIStackView's axis and real device 以编程方式创建带有2个对齐标签的水平UIStackView - Programmatically created horizontal UIStackView with 2 justified labels UIStackView,2个标签:根据尺寸更改轴 - UIStackView, 2 labels: Change Axis based on size 在UIStackView中按比例填写 - Fill Proportionally in UIStackView 带标签的旋转轮-如何在旋转时使标签保持水平? - Rotating Wheel with labels - how to keep labels horizontal as the wheels rotates? 如何清除填充了表情符号字符的字体缓存? - How to clear font cache filled with emoji characters? 如何在水平UIStackView中对齐两个标签的底部? - How do I align the bottoms of two labels in a horizontal UIStackView? 隐藏其中的标签时,UIStackview不调整大小 - UIStackview not resizing when hiding the labels inside it 设备旋转后直接开火的方法 - Method to fire directly after device rotates
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM