File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -96,21 +96,12 @@ - (CGFloat)fd_heightForCellWithIdentifier:(NSString *)identifier configuration:(
96
96
} else {
97
97
// Add a hard width constraint to make dynamic content views (like labels) expand vertically instead
98
98
// of growing horizontally, in a flow-layout manner.
99
-
100
- /* 修复1.3版本存在的一个bug:给contentView添加宽度为0的约束,会与已有子视图约束冲突. */
101
- if (0 != contentViewWidth) {
102
- NSLayoutConstraint *tempWidthConstraint =
103
- [NSLayoutConstraint constraintWithItem: cell.contentView
104
- attribute: NSLayoutAttributeWidth
105
- relatedBy: NSLayoutRelationEqual
106
- toItem: nil
107
- attribute: NSLayoutAttributeNotAnAttribute
108
- multiplier: 1.0
109
- constant: contentViewWidth];
110
- [cell.contentView addConstraint: tempWidthConstraint];
99
+ if (contentViewWidth > 0 ) {
100
+ NSLayoutConstraint *widthFenceConstraint = [NSLayoutConstraint constraintWithItem: cell.contentView attribute: NSLayoutAttributeWidth relatedBy: NSLayoutRelationEqual toItem: nil attribute: NSLayoutAttributeNotAnAttribute multiplier: 1.0 constant: contentViewWidth];
101
+ [cell.contentView addConstraint: widthFenceConstraint];
111
102
// Auto layout engine does its math
112
103
fittingSize = [cell.contentView systemLayoutSizeFittingSize: UILayoutFittingCompressedSize];
113
- [cell.contentView removeConstraint: tempWidthConstraint ];
104
+ [cell.contentView removeConstraint: widthFenceConstraint ];
114
105
}
115
106
}
116
107
You can’t perform that action at this time.
0 commit comments