Can you add a button as a subview to a uitableview cell and have that clickable, but not the cell itself. ie: I don't want the selected view to come up. Obvs I can just not have the cell disclose anywhere, but I don't want it to look "selected" when someone taps it.
Setting user interaction enabled to NO makes the whole thing unenabled, including the buttons.
Any ideas?
Thank you.
Tom
If you want to disable selection for just some of the cells, use: cell. userInteractionEnabled = NO; As well as preventing selection, this also stops tableView:didSelectRowAtIndexPath: being called for the cells that have it set.
deselectRow(at:animated:) Deselects a row that an index path identifies, with an option to animate the deselection.
A view that presents data using rows in a single column.
cell.selectionStyle = UITableViewCellSelectionStyleNone;
This will prevent the cell to highlight for a bit before the willSelect returns nil
implement this delegate method:
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
return nil;
}
and set the UITableViewCells selectionStyle property to UITableViewCellSelectionStyleNone
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With