我想使用自定义 UITableViewCell 高度(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath。
我试图UITableViewCell通过将行数乘以textLabel每行的高度然后添加10.0f字幕来获得高度。我正在使用以下代码并获取exc_bad_access(). 为什么?
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return ([[[tableView cellForRowAtIndexPath:indexPath] textLabel] numberOfLines] * [[[[tableView cellForRowAtIndexPath:indexPath] textLabel] font] lineHeight]) + 10.0;
//return kRowHeightiPod; //A constant value for a sanity check
}