Michael Morrison
Michael Morrison

Reputation: 1323

UIButton also highlighting when cell is touched

I've a UIButton on my table cell that pops up (touchUpInside) a UIAlertView and asks the user if they want to delete the file associated with that cell. Otherwise, a touch on the cell itself highlights the cell then moves to the next level to reveal content. The issue is that when the cell is selected and highlighted, the button highlights as well, confusing the user.

How can I tell the button to ignore touches to the cell or tell the cell to leave the damn button alone.

Upvotes: 3

Views: 1260

Answers (1)

Brandon
Brandon

Reputation: 973

I tried this workaround with mixed results. While it will return the button to its normal state, there is a brief flicker as it changes from normal, to selected, and back to normal again.

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    CustomCell *cell = (CustomCell *)[tableView cellForRowAtIndexPath:indexPath];
    cell.button.highlighted = NO;
}

Upvotes: 1

Related Questions