When setting up the cell
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
CGRect frame = CGRectMake(0.0, 0.0, 40, 40); //Image size
button.frame = frame;
if ([AppMain sharedAppMain].CurrentView == CURRENT_VIEW_PLAYLISTS)
{
forState:UIControlStateNormal];
}
else if (DisplayGreyedOut)
{
forState:UIControlStateNormal];
}
else
{
forState:UIControlStateNormal];
}
;
cell.accessoryView = button;
return cell;
Button Press
//**********************************************
//**********************************************
//********** ACCESSORY BUTTON PRESSED **********
//**********************************************
//**********************************************
- (void)checkButtonTapped:(id)sender event:(id)event
{
NSSet *touches = [event allTouches];
UITouch *touch = [touches anyObject];
CGPoint currentTouchPosition = [touch locationInView:self.tableView];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint: currentTouchPosition];
if (indexPath != nil)
{
[self tableView: self.tableView accessoryButtonTappedForRowWithIndexPath: indexPath];
}
}
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"PRESSED");
}