標籤:
// Use the estimatedHeight methods to quickly calcuate guessed values which will allow for fast load times of the table.// If these methods are implemented, the above -tableView:heightForXXX calls will be deferred until views are ready to be displayed, so more expensive logic can be placed there.- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(7_0);- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForHeaderInSection:(NSInteger)section NS_AVAILABLE_IOS(7_0);- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForFooterInSection:(NSInteger)section NS_AVAILABLE_IOS(7_0);
以上三個table view的代理方法可以實現將對應的
tableView: heightForRowAtIndexPath:
tableView: heightForHeaderInSection:
tableView: heightForFooterInSection:
三個代理方法與返回cell,header view,footer view的代理方法調換先後執行順序
然後乖乖的計算高度並在相應的方法中返回高度就行了~
至於怎樣計算,百度或者google一下就可以找到很多部落格~
加班ing~
iOS 動態計算cell高度實用API