Open yuekewei opened 5 years ago
如果self即UITableView使用代码添加约束时,第一次调用fd_systemFittingHeightForConfiguratedCell方法时UITableView宽度为0,在使用- (CGFloat)fd_heightForCellWithIdentifier:(NSString )identifier cacheByIndexPath:(NSIndexPath )indexPath configuration:(void (^)(id cell))configuration使用缓存高度时,如果UITableView不刷新,缓存高度不对,应改为
(CGFloat)fd_systemFittingHeightForConfiguratedCell:(UITableViewCell *)cell { if (self.superview) { [self.superview layoutIfNeeded]; }
CGFloat contentViewWidth = CGRectGetWidth(self.frame); 使用layoutIfNeeded获取UITableView正确宽度
666,可以的
如果self即UITableView使用代码添加约束时,第一次调用fd_systemFittingHeightForConfiguratedCell方法时UITableView宽度为0,在使用- (CGFloat)fd_heightForCellWithIdentifier:(NSString )identifier cacheByIndexPath:(NSIndexPath )indexPath configuration:(void (^)(id cell))configuration使用缓存高度时,如果UITableView不刷新,缓存高度不对,应改为
(CGFloat)fd_systemFittingHeightForConfiguratedCell:(UITableViewCell *)cell { if (self.superview) { [self.superview layoutIfNeeded]; }
CGFloat contentViewWidth = CGRectGetWidth(self.frame); 使用layoutIfNeeded获取UITableView正确宽度