Unfortunately, "accessoryTypeForRowWithIndexPath" is deprecated.
The key to the different behavior (between the UITableViewCellAccessoryDisclosureIndicator and the UITableViewCellAccessoryDetailDisclosureButton) is that the INDICATOR of the expansion does not track, while the BUTTON of the expansion does the โtrackingโ.
What you need to do is to provide your own recognition of where the user is listening in the cell, and use it as part of additional code to call in
- (void)tableView:(UITableView*) tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath*) indexPath
- this is what happens with the opening BUTTON.
You might want to use something like a UITapGestureRecognizer connected to an AccessoryView in your custom cell. Usually this is NIL, so you need to add a UIView to the cell via IB or programmatically - change its size and connect it to your cell object. Then you add the code to your custom cell function - (id)initWithStyle:(UITableViewCellStyle) style reuseIdentifier:(NSString*) reuseIdentifier .
The general idea is shown below.
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:myAccessoryView action:@selector(didTap:)]; tapGesture.delegate = (id <UIGestureRecognizerDelegate>)myTableViewControllerDelegate; [containerView addGestureRecognizer:tapGesture]; [tapGesture release];
The "didTap:" function then forwards your code, or simply does what you could do in another routine.
It is sad that three different accessories are handled differently. So, if you do not want your camera to have a blue and blue substance, it looks like you have to come up with additional code to make it work the way you would like.
One of the advantages of using AccessoryView in a custom cell is that you can put a UIImageView in a view and then put the image in a UIImageView, which means that you can use any image compared to a simple ">" expansion.
source share