简体   繁体   中英

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

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

在此输入图像描述

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

在此输入图像描述

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;
}

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.

也许您的UIImageView是突出显示的背景视图的子视图,仅在选择单元格时可见?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM