Richard M
Richard M

Reputation: 1

Add custom icon to UITableView cell in edit mode

I'm new to Xcode. I know how to customize a cell for a UITableView, but I'm wondering how to customize the cell for Edit Mode.

I want to:

  1. add an icon (pencil) to the right of the minus
  2. and when cause that to happen when the user clicks on the pencil call a method.

Sorry for the caps, and thank you for fixing it.

I tried to upload a screenshot but because I'm new I can't. But the minus icon I'm referring to is the one that appears when you are in a table view and hit Edit button add the minus icon is added to each cell.

Thanks Dhara, I'll try to do what you suggest, hope it works. But other ideas are welcome.

Upvotes: 0

Views: 1499

Answers (1)

Dhara
Dhara

Reputation: 4089

You can do following to add a pencil

  1. Check if the table is in editing mode then add a custom button and set its image as your pencil image (do this in cellForRowAtIndexPath or make a custom cell and load it in cellForRowAtIndexPath).
  2. Give that custom pencil a tag and also assign the method to it.
  3. On pressing that pencil the method will be called and you can differentiate the different pencils on the basis of the tags.

Hope this helps you.

Upvotes: 1

Related Questions