Skip to content

Commit bfe6111

Browse files
authored
1 parent faa4596 commit bfe6111

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Classes/UITableView+FDTemplateLayoutCell.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ - (CGFloat)fd_systemFittingHeightForConfiguratedCell:(UITableViewCell *)cell {
5959
NSLayoutConstraint *widthFenceConstraint = [NSLayoutConstraint constraintWithItem:cell.contentView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:contentViewWidth];
6060

6161
// [bug fix] after iOS 10.3, Auto Layout engine will add an additional 0 width constraint onto cell's content view, to avoid that, we add constraints to content view's left, right, top and bottom.
62-
static BOOL isSystemVersionEqualOrGreaterThen10_3 = NO;
62+
static BOOL isSystemVersionEqualOrGreaterThen10_2 = NO;
6363
static dispatch_once_t onceToken;
6464
dispatch_once(&onceToken, ^{
65-
isSystemVersionEqualOrGreaterThen10_3 = UIDevice.currentDevice.systemVersion.floatValue >= 10.3;
65+
isSystemVersionEqualOrGreaterThen10_2 = [UIDevice.currentDevice.systemVersion compare:@"10.2" options:NSNumericSearch] != NSOrderedAscending;
6666
});
6767

6868
NSArray<NSLayoutConstraint *> *edgeConstraints;
@@ -86,7 +86,7 @@ - (CGFloat)fd_systemFittingHeightForConfiguratedCell:(UITableViewCell *)cell {
8686

8787
// Clean-ups
8888
[cell.contentView removeConstraint:widthFenceConstraint];
89-
if (isSystemVersionEqualOrGreaterThen10_3) {
89+
if (isSystemVersionEqualOrGreaterThen10_2) {
9090
[cell removeConstraints:edgeConstraints];
9191
}
9292

0 commit comments

Comments
 (0)