I´m doing a sample project in order to learn about prototype cells on iOS and, most important, target action triggered by UIControls inside those prototype cells. I´ve already accomplish this by subclassing the UITableCell, setting a protocol and have the UITableViewController be the delegate.
The problem I´m encountering now is that I´m setting the title text of the buttons inside cellForIndexPath by something like this (I´m not on my computer now):
MyCustomCell *cell=... (as usual)
cell.button.Title.text=[datasource objectAtIndex:indexPath.row];
this works ok UNTIL I click on the button. Then the button displays the default Title (which by the way if I don´t set on storyboard, no title appears at all).
refreshing the row with animationAutomatic after the action triggered by the button sets the title back to what I want, but while clicking on it, the default title still appears and I don´t find it very attractive for the user. (I certanly woudn´t like to see if I buy an App).
Does anyone have a pointer here to help me out?
Thanks in advance!
You should not modify the text of buttons directly through the properties, rather you should use the setTitle:forState: selector like this:
Documentation: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIButton_Class/UIButton/UIButton.html