属性文本 UILabel 在 UICollectionViewCell 中被截断但在 UITableViewCell 中没有截断
Attributed text UILabel cut off in UICollectionViewCell but not in UITableViewCell
UICollectionViewCell 中的属性文本 UILabel 在滚动后被截断(自动布局已打开)。
为什么 UITableViewCell 中的相同设置工作正常。 (约束/优先级也相同)
使用自定义字体和自动换行
通过为 UILabel 属性 preferredMaxLayoutWidth 减去您在布局中使用的可能偏移量来解决此问题。
self.yourUIlabel.preferredMaxLayoutWidth = CGRectGetWidth(self.bounds) - yourOffsets;
在这里找到答案:http://johnszumski.com/blog/auto-layout-for-table-view-cells-with-dynamic-heights
类似问题:Word Wrap not working for UILabel & UILabel not wrapping text correctly sometimes (auto layout)
但有些问题仍然存在,为什么我在 UITableViewCell
中不需要这个 属性
UICollectionViewCell 中的属性文本 UILabel 在滚动后被截断(自动布局已打开)。
为什么 UITableViewCell 中的相同设置工作正常。 (约束/优先级也相同)
使用自定义字体和自动换行
通过为 UILabel 属性 preferredMaxLayoutWidth 减去您在布局中使用的可能偏移量来解决此问题。
self.yourUIlabel.preferredMaxLayoutWidth = CGRectGetWidth(self.bounds) - yourOffsets;
在这里找到答案:http://johnszumski.com/blog/auto-layout-for-table-view-cells-with-dynamic-heights
类似问题:Word Wrap not working for UILabel & UILabel not wrapping text correctly sometimes (auto layout)
但有些问题仍然存在,为什么我在 UITableViewCell
中不需要这个 属性