iPhone UITableView - action on accessory click
I am trying to link the click of an accessory button in a UITableView
to a method in a particular class. The accessory is on multiple cells, created in code, and thus I can't just do a simple link in interface builder like I am used to.
How do I link an accessory arrow (from the end of a cell in a UITabl开发者_如何学编程eView
) to a method?
Check out the tableView:accessoryButtonTappedForRowWithIndexPath:
method on the UITableViewDelegate
.
This is no longer valid, Xcode flags a warning it is now depreiated;
WARNING: Using legacy cell layout due to delegate implementation of tableView:accessoryButtonTappedForRowWithIndexPath: in . Please remove your implementation of this method and set the cell properties accessoryType and/or editingAccessoryType to move to the new cell layout behavior. This method will no longer be called in a future release. See here: https://developer.apple.com/documentation/uikit/uitableviewdelegate
精彩评论