今天升級了Xcode9,發(fā)現(xiàn)之前用的列表自適應(yīng)高度布局混亂了旦签,每個rowheight都返回44,查了很多技術(shù)文檔說默認(rèn)是支持self-sizing,除非設(shè)置estimatedRowHeight=0;
self.tableView.estimatedRowHeight = 60;
@property (nonatomic) CGFloat rowHeight; // default is UITableViewAutomaticDimension
@property (nonatomic) CGFloat sectionHeaderHeight; // default is UITableViewAutomaticDimension
@property (nonatomic) CGFloat sectionFooterHeight; // default is UITableViewAutomaticDimension
@property (nonatomic) CGFloat estimatedRowHeight NS_AVAILABLE_IOS(7_0); // default is UITableViewAutomaticDimension, set to 0 to disable
@property (nonatomic) CGFloat estimatedSectionHeaderHeight NS_AVAILABLE_IOS(7_0); // default is UITableViewAutomaticDimension, set to 0 to disable
@property (nonatomic) CGFloat estimatedSectionFooterHeight NS_AVAILABLE_IOS(7_0); // default is UITableViewAutomaticDimension, set to 0 to disable
加了一句
self.tableView.rowHeight = UITableViewAutomaticDimension;
然后就OK了...