【发布时间】:2017-07-11 10:49:54
【问题描述】:
我只是, 1) 出列单元格 2)检查零 3)根据情况设置单元格数据 并返回单元格。
这段代码有什么问题?我究竟做错了什么?只需检查nil。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
GSDischargeListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
[tableView registerClass:[GSDischargeListCell class] forCellReuseIdentifier:cellIdentifier];
}
if (_searchController.active && ![_searchController.searchBar.text isEqual: @""] ) {
GSDischargePatient *patient = searchResultsArray[indexPath.row];
[cell setCellData:patient];
} else {
GSDischargePatient *patient = datasourceArray[indexPath.row];
[cell setCellData:patient];
}
_totalHeight = [cell estimatedHeightOfCell];
return cell;
}
【问题讨论】:
标签: objective-c uitableview tableview