-2
每12個格在我的tableview有相同的地址,這會導致一個問題:當我向一個小區,與該地址的所有的細胞得到這裏所謂objective-c。 TableView中的細胞具有相同的地址
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
static NSString *CellIdentifier = @"datacell";
DataCell *cell = (DataCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (cell==nil) {
cell= [[DataCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
if (indexPath.row==1) {
cell.backgroundColor= [UIColor redColor];
}
return cell;
例如,雖然我只將紅色設置爲一個單元格,但每個第13個單元格都會變爲紅色背景。所以我有4個紅色背景的細胞。我不知道發生了什麼:@:@
爲什麼你不知道?這是這裏回答的最常見問題之一。只要搜索,你會發現。 – matt
我確實搜索過,你能幫我一個鏈接嗎? –
例如:http://stackoverflow.com/questions/20781556/strange-behaviour-on-table-view-with-core-data – matt