I have been struggling with a cell disclosue button... First it was saying it is depreciated as I was using:
-(UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellAccessoryDetailDisclosureButton;
}
So I commented that out and added the disclosure to the cell in the configureCell using:
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.editingAccessoryType = UITableViewCellAccessoryNone;
However now my disclosure button does nothing. What do I need to add to get the disclosue button to work. All my googling has come up with are other depreciated methods. Any help or pointers would be much appreciated.
If you actually want a detail disclosure button, make sure that you are setting your cell accessory type to UITableViewCellAccessoryDetailDisclosureButton
. (Your sample code shows UITableViewCellAccessoryDisclosureIndicator
.) You handle detail disclosure button taps in your table view delegate's tableView:accessoryButtonTappedForRowWithIndexPath:
method. You handle row selection (no matter what the accessory view is) in your table view delegate's tableView:didSelectRowAtIndexPath:
method.
Use this method in you table view delegate
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With