2015-06-25 55 views

回答

0

我不知道是否有這樣做就像使用UITableViewAutomaticDimension除了使用自動佈局約束的自動方式

你可以做的是創造一個約束屬性

@property (nonatomic, strong) NSLayoutConstraint *heightConstraint; 

然後計算創建後的單元格內容大小以及updateConstraints更新高度約束常量

self.heightConstraint.constant = calculatedHeight; 

最後只要你有更新的內容調用setNeedsUpdateConstraints

相關問題