iamsmug
iamsmug

Reputation: 1509

Adding a button to a table cell

I have added a button to a table and used the event method to find out the indexpath of the cell it was pressed in to get information and update another entity.

Sometimes it doesn't return an indexpath even though I know the button was pressed.

Any help would be good please.

Upvotes: 0

Views: 2076

Answers (1)

Steve N
Steve N

Reputation: 2737

First off, is there a reason you aren't just using didSelectRow:atIndexPath to get the row and update your other entity?

This is a bit vague to provide an answer, but I would be suspicious of your cell re-use code in cellForRowAtIndexPath method. That is often where issues in table view cells are created... are you handling re-used cells properly with regard to this custom button?

-S

Upvotes: 1

Related Questions