當您滑動tableview和單元格被隱藏或刪除時,是否有任何方法在UITableView
中使用tableviewcell。我有這樣的代碼:UITableViewCell單元格不顯示
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
int curIndex = 0;
for (int i = 0; i < [dataHolder.dateArray count]; i++)
{
if ([[dataHolder.dateArray objectAtIndex:i] isEqual:[dataHolder.allDates objectAtIndex:[indexPath section]]])
{
if ([self indexHasContains:i] == NO)
{
curIndex = i;
[indexHasChossen addObject:[NSString stringWithFormat:@"%i", i]];
break;
}
}
}
cell.selectionStyle = UITableViewCellSelectionStyleGray;
cell.textLabel.text = [NSString stringWithFormat:@"%@, %@", [dataHolder.courseArray objectAtIndex:curIndex], [dataHolder.placeArray objectAtIndex:curIndex]];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@", [dataHolder.timeArray objectAtIndex:curIndex]];
cell.selectionStyle = UITableViewCellSelectionStyleGray;
cell.textLabel.textColor = [UIColor blackColor];
cell.detailTextLabel.textColor = [UIColor whiteColor];
return cell;
}
我也希望從indexHasChossen陣列當細胞被隱藏/刪除delets的方法。我瀏覽了蘋果文檔,還沒有找到任何東西。做任何人都知道任何方式來做到這一點?