我正在编写一个应用程序,其中包含课程作为tableView的子视图,当用户完成课程时,它根据BOOL数组取消隐藏我的自定义TableViewCell的复选标记。我的问题是当用户在整个TableView中滚动时,如何让viewWillAppear查询数组的右侧部分。
目前的守则:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[TableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
if ([indexPath section] == 0)
{
cell.lessonTitle.text = [[sectionOneArray objectAtIndex: indexPath.row] lessonTitle];
cell.LeftImageView.image = [UIImage imageNamed:@"1Icon.png"];
}
else if ([indexPath section] == 1)
{
cell.lessonTitle.text = [[sectionTwoArray objectAtIndex: indexPath.row] lessonTitle];
cell.LeftImageView.image = [UIImage imageNamed:@"2Icon.png"];
}
else if ([indexPath section] == 2)
{
cell.lessonTitle.text = [[sectionThreeArray objectAtIndex: indexPath.row] lessonTitle];
cell.LeftImageView.image = [UIImage imageNamed:@"3Icon.png"];
}
else if ([indexPath section] == 3)
{
cell.lessonTitle.text = [[sectionFourArray objectAtIndex: indexPath.row] lessonTitle];
cell.LeftImageView.image = [UIImage imageNamed:@"4Icon.png"];
}
// Set up the cell…
cell.lessonTitle.highlightedTextColor = [UIColor whiteColor];
cell.CheckMarkBox.image = [UIImage imageNamed:@"checkMarkBox.png"];
cell.CheckMark.image = [UIImage imageNamed:@"checkMark.png"];
cell.selectionStyle = UITableViewCellSelectionStyleGray;
/* Heres where I get confused
if ( )
{
cell.CheckMark.hidden = FALSE;
}
else
{
cell.CheckMark.hidden = TRUE;
}*/
return cell;
}