Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

SqueegyX

macrumors regular
Original poster
Mar 24, 2008
108
1
According to the docs, I set a custom view to the accessoryView property of a table cell. And, according to the docs, and I make it tappable (like a UITableViewCellAccessoryDisclosureButton) by setting the userInteractionEnabled property of the accessory view to YES.

Sadly, its not working. This code works great if I use the UITableViewCellAccessoryDisclosureButton, but with my custom view tapping the accessory is ignored.

Code:
  UIImageView *accessory = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"EquipAccessory.png"]];
    accessory.userInteractionEnabled = YES;
    cell.accessoryView = accessory;
    [accessory release];

Am I missing something here?

EDIT:

I realized the docs say the userInteractionEnabled property needs to be set on the cell, not the accessory. But it still isnt working. Even explicitly setting the target and action isn't working.

Code:
    UIImageView *accessory = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"EquipAccessory.png"]];
    cell.accessoryView = accessory;
    accessory.userInteractionEnabled = YES;
    [accessory release];
    
    cell.accessoryAction = @selector(tappedEquipButton:);
    cell.userInteractionEnabled = YES;
    cell.target = self;
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.