fredley
fredley

Reputation: 33901

Why is my ImageView only visible when the cell is highlighted?

I have a custom Cell for my TableView, with an ImageView on it.

enter image description here

Why is the ImageView only visible when the cell is highlighted?

enter image description here

The cells are created thusly:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];

    Site *site = [self.dataController objectInListAtIndex:indexPath.row];

    [[cell textLabel] setText:site.description];
    return cell;
}

Upvotes: 0

Views: 133

Answers (2)

Max
Max

Reputation: 6239

Check out: Custom UITableViewCell (IB) only shows in selected state

The quick synopsis of it "Filling the standard UITableViewCell.textLabel.text seems to overwrite the PrototypeCells". So it would appear you have to create and add a different text label.

Upvotes: 2

Zaphod
Zaphod

Reputation: 7270

Maybe your UIImageView is a subview of the highlighted background view, only visible when the cell is selected?

Upvotes: 0

Related Questions