Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cell view disclosure button and relevent method

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.

like image 226
Designer023 Avatar asked Oct 02 '10 20:10

Designer023


2 Answers

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.

like image 130
James Huddleston Avatar answered Nov 14 '22 18:11

James Huddleston


Use this method in you table view delegate

    - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
like image 3
Jorge Avatar answered Nov 14 '22 16:11

Jorge