views:

25

answers:

2

hi,

I have been struggling with a cell disclosue button... First it was saying it is depreciated as I was using:

Code:

-(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:

Code:

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.

Cheers,

A: 

Use this method in you table view delegate

    - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
Jorge
I was using this already, turns out that because I was using UITableViewCellAccessoryDisclosureIndicator not UITableViewCellAccessoryDetailDisclosureButton that it wasn't calling it :) All fixed and working now. Thanks for the help
Designer023
+2  A: 

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.

James Huddleston
That's where I was going wrong. I had the icon that was just > not a > in a circle so when I changed the type to UITableViewCellAccessoryDetailDisclosureButton it worked just as before. Thanks for the heads up
Designer023