Raptor
Raptor

Reputation: 54278

Simulate didSelectRowAtIndexPath with a UIButton in a customized UITableViewCell

I have a UIButton in a customized UITableViewCell, which subclassing UITableViewCell.

The UIButton is IBOutlet-ed in IB, and IBAction-ed to a function:

- (IBAction)clickRead:(id)sender;

Now, when I click on the button, the button has no response, since the function has nothing inside. What should I write in the function so that the UIButton can simulate tableView's didSelectRowAtIndexPath function ( i.e. select the table cell ) ?

Upvotes: 1

Views: 1838

Answers (1)

mblakele
mblakele

Reputation: 7852

This answer might help: hitting a next button for a UITableViewcell

You can call UITableView selectRowAtIndexPath:animated:scrollPosition: to visually select the row, but you will still have to manage any events for yourself: loading another view, calling didSelectRowAtIndexPath:, storyboard segues, etc.

Upvotes: 1

Related Questions