Olie
Olie

Reputation: 24685

Why won't my UITableViewCellAccessoryCheckmark display?

In my - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath, I originally had:

if ([UploadManager isFileUploaded: filename])
    cell.accessoryType = UITableViewCellAccessoryCheckmark;
else
    cell.accessoryType = UITableViewCellAccessoryNone;

but, thinking there might be a bug in my UploadManager, I changed it to:

if ([UploadManager isFileUploaded: filename])
    cell.accessoryType = UITableViewCellAccessoryCheckmark;
else
    cell.accessoryType = UITableViewCellAccessoryCheckmark;

for testing. However, my cells STILL don't show the checkmark. What am I doing wrong?!

Thanks!

EDIT:

It shouldn't matter but, just in case, here's my whole (most of) 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;
}

Upvotes: 0

Views: 277

Answers (1)

Olie
Olie

Reputation: 24685

Oh duh! Nevermind...

I'd delete the question, but someone in the future might make the same mistake, so I'm leaving it up for them.

My client has this weird requirement where he wants the table to ALWAYS be in editing mode, so the little round, red delete-row buttons are always showing. Hence, I had self.tableview.editing = YES; in my viewDidLoad. tableview.editing hides the checkmark, and turning that off brings it back.

D'oh!

I guess I'll have to convince him to send me a checkmark artwork that I can use in an imageview or some such.

(I already tried to convince him not to be in always-edit mode -- no joy.)

Upvotes: 1

Related Questions