Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change image of a UITableViewCell

I have a UITableView that uses the UITableViewCellStyleDefault style. I also have set the detail accessory:

    cell.accessoryType= UITableViewCellAccessoryDetailDisclosureButton;

I want the code to be so that when the detail accessory is push, thus generating the delegate method accessoryButtonTappedForRowWithIndexPath: , the image of that particular cell is changed to another image.

How can I do that? Do I need to recreate the cell somehow?

Thank you!

like image 219
Kevin Avatar asked Dec 22 '25 11:12

Kevin


1 Answers

no you have to just add the other image in the cell's imageview as

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.imageView.image = [UIImage imageNamed:@"IMAGENAME"];
like image 151
The iOSDev Avatar answered Dec 24 '25 01:12

The iOSDev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!