How to add a cutsom accessory image to a Table View Cell

- by

Each table view cell has an accessory type on the right. You can check which one should be shown by default in Interface Builder (those are none, tick box (aka checkmark), disclosure and detail disclosure chevrons). You can however use your own graphics in this place.

All we need to do is add our own UIImageView as a subview to the cell’s view. Sounds complex, I know – but it’s just as easy as adding a background image to a table view.

We add our custom accessory image in the tableView:cellForRowAtIndexPath method like so:

cell.accessoryView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"my-image.png"]];

Make sure you add this before the return cell call.



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

Leave a Comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.