i am trying to know the best way to add custom buttons in UITableViewCell if we have a lot of data to show. I know about cell.button.tag = indexPath.row
method to get the indexPath of button, but if there's much more data in the tableViewCell
things get messed up using tag
if i set the title to be changed when tapped some other cell's button title also changes automatically.. I've been finding a solution from 2-3 weeks.. Help me out here please. Thanks for your time. A nice tutorial or explanation would do best. Because I'am a beginner..
Asked
Active
Viewed 1,272 times
1

rmaddy
- 314,917
- 42
- 532
- 579

Akshay Kheveria
- 201
- 1
- 15
-
Why not use a custom cell subclass? Each would have its own button property, and you wouldn't need to mess about with `tag` which is really archaic. – Stuart Aug 09 '15 at 02:26
-
can you provide me a link/explanation for that? – Akshay Kheveria Aug 09 '15 at 03:01
-
1The internet is littered with good examples, try googling "custom UITableViewCell". – Stuart Aug 09 '15 at 10:28
1 Answers
4
This is likely too late to help you, but in case someone else needs to be pointed in the right direction:
This tutorial has a quick rundown on implementing buttons in custom table view cells using the delegate method. Good luck!
Quick edit: The accepted answer here does a good job of explaining it clearly as well.