1
我需要爲插入的單元格設置不同的樣式,與重載的單元格相比。如何判斷單元格是否在cellForRowAtIndexPath中插入或重新加載?
我將像下面的我的細胞:
[tempArray addObject:[NSIndexPath indexPathForRow:0 inSection:0]];
[[self tableView] beginUpdates];
[[self tableView] insertSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationTop];
[[self tableView] insertRowsAtIndexPaths:(NSArray *)tempArray withRowAnimation:UITableViewRowAnimationNone];
[[self tableView] endUpdates];
有沒有爲我做了以下的方式:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (cell was inserted) {
cell.mylabel.textColor = [UIColor redColor];
} else {
cell.mylabel.textColor = [UIColor blackColor];
}
}
您可以使用電池的標籤值了點。默認值爲0,將其更改爲1或其他值。 –
嗯,但兩者都會使用相同的單元格類別,所以不要以爲我可以通過標記值區分它們,因爲它們會相同。 – teggy