I am using a UITableView and the cells I am using in this view should do nothing when I click them. I can't turn off UserInteraction though because then I am not able to click on the accessory (detailDisclosureButton). So how can I make them stop turning blue and still allow them to click on the accessory?
8 Answers
By default, the selectionStyle property of cell is UITableViewCellSelectionStyleBlue. Change it to UITableViewCellSelectionStyleNone.
1 Comment
When you're generating the UITableViewCell (within the UITableView's - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath method call), simply set the selectionStyle property to UITableViewCellSelectionStyleNone.
Set the UITableViewCell Class Reference for more information.
Comments
tableView.allowsSelection = NO; 2 Comments
You can do this by adding the selection style to none or gray. By default it is blue.
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleGray;
You need to write this code in the method "- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath".


:)tableView:didSelectRowAtIndexPath:from firing. Just because you won't SEE the selection doesn't mean it won't HAPPEN. I say this just to remind you to handle for that in the method I mentioned above.