Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Accessory View on UITableView Prototype Cell Not Firing

I have a custom accessory view (a UIButton) on my prototype cell in a storyboard. When I click that button the delegate method for accessory button tapped isn't called. If I use a standard disclosure button it is called just fine. I'm assuming I'm missing a hook up somewhere. Anybody know where?

like image 902
codeetcetera Avatar asked Mar 20 '13 17:03

codeetcetera


2 Answers

Guess 1: You don't really have a "custom accessory view" you have a UIButton which is placed where an accessory would go. This wouldn't fire the delegate accessory tapped button because it's not really an accessory.

Guess 2: You do have a real accessory view, but it's never getting the "tap" event because you have a UIButton in it which is eating the user interaction but not firing an action. In that case try adding a simple UIView instead.

Other than that, I'd need more information.

like image 77
DBD Avatar answered Oct 20 '22 07:10

DBD


apple docs for the accessory delegate method says

The delegate usually responds to the tap on the disclosure button (the accessory view) by displaying a new view related to the selected row. This method is not called when an accessory view is set for the row at indexPath.

so it is not called for custom accessory views. it is a standard behaviour.

like image 30
Tejesh Alimilli Avatar answered Oct 20 '22 07:10

Tejesh Alimilli