UITableViewCell Set Selected Image

后端 未结 5 1195
误落风尘
误落风尘 2021-02-07 08:26

trying to figure out how to set the selected image for for a tableViewCell.

The old way of writing this was cell.selectedImage but that has bee

5条回答
  •  情深已故
    2021-02-07 08:47

    That didn't worked because you might set the normal state image like this

    cell.imageView.image = ///
    

    Try it - It worked for me perfectly!!

    UIImageView *selBGView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"urimage_selected.png"]];
     cell.selectedBackgroundView = selBGView;
    [selBGView release];
    
    UIImageView *BGView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"urimage.png"]];
     cell.backgroundView = BGView;
    [BGView release];
    

提交回复
热议问题