私の- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
、私はもともと持っていました:
if ([UploadManager isFileUploaded: filename])
cell.accessoryType = UITableViewCellAccessoryCheckmark;
else
cell.accessoryType = UITableViewCellAccessoryNone;
しかし、私の UploadManager にバグがあるのではないかと考えて、次のように変更しました。
if ([UploadManager isFileUploaded: filename])
cell.accessoryType = UITableViewCellAccessoryCheckmark;
else
cell.accessoryType = UITableViewCellAccessoryCheckmark;
テスト用。ただし、私のセルにはまだチェックマークが表示されません。私は何を間違っていますか?!
ありがとう!
編集:
それは問題ではありませんが、念のため、これが私の全体(ほとんど)ですcellForIndexPath
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"fileList-cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault
reuseIdentifier: CellIdentifier];
}
int row = [indexPath row];
// Create cell layout
NSString *filename = [self.tableItems objectAtIndex: row];
// Name label
UILabel *nameLabel = (UILabel*)[cell viewWithTag: nameLabelTag];
if (nameLabel == nil)
{
nameLabel = [UILabel new];
// blah blah, snip
[cell addSubview: nameLabel];
}
nameLabel.text = filename;
[nameLabel sizeToFit];
CGRect rect = nameLabel.frame;
rect.origin.x = 50;
nameLabel.frame = rect;
// More UI added to cell here. Snip
// Is uploaded checkmark
if ([UploadManager isFileUploaded: filename])
cell.accessoryType = UITableViewCellAccessoryCheckmark;
else
cell.accessoryType = UITableViewCellAccessoryCheckmark;
return cell;
}