내가 너무 문제를 만난다. 그리고 그것은 나를 많이 좌절 시켰습니다. 몇 가지 고려 사항 후, 그것은 그것이 빈 셀을 보여 tableview의 기능을 수 있습니다 생각합니다. 공백 셀의 마지막 셀 높이를 사용하는 것이 합리적입니다. 그렇지 않으면, 어떤 높이를 사용해야합니까?
검은 셀을 표시하는 것이 허용되지 않는다고 생각합니다. 당신이 나 같은 스타일을 싫어하는 경우에, 당신은 빈 셀을 제거하려면이 옵션을 시도 할 수 있습니다 :
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
또는
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
//then add view for separator line by yourself
또는
UITableView *tableView = [[UITableView alloc] initWithFrame:self.tableView.frame style:UITableViewStyleGrouped];
tableView.backgroundColor = self.tableView.backgroundColor;
self.tableView = tableView;
당신이 빈 셀과 제어를 표시해야하는 경우 키를 추가하는 가장 간단한 방법/해결 방법 일 수도 있습니다. 예 :
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataArray == nil || self.dataArray.count == 0 ? 1 : self.dataArray + 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.count == self.dataArray.count){ //the last cell
cell = [[UITableViewCell alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 50)];
} else {
cell = .... //as uausal
}
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.count == self.dataArray.count){
return 50;
} else {
return xxx; //as usual
}
}
이제 모든 높이를 제어 할 수 있습니다.
희망이 있으면 도움을 드리겠습니다.
당신은뿐만 아니라 링크를 참조 할 수 있습니다 : How can I modify the appearance of 'empty' cells in plain UITableView? 홀수
: 당신이 볼 수 세포의 수, 빈 여부로 HFRAIP/CFRAIP에 많은 전화를 받아야합니다. 이게 당신이 보는 것과 다른가요? – dasblinkenlight
아니요, 실제로 필요한 셀을 호출합니다. 마지막으로 사용한 셀에서 치수를 재사용하고 있습니다. –