I use IB and uncheck the 'Show selection on touch' but it still show blue highlight on cell that is selected. Is this a bug with apple or I am getting something wrong.
You need to set the selectionStyle property on the cell: cell. selectionStyle = UITableViewCellSelectionStyle. None in Swift, or cell.
A view that presents data using rows in a single column. iOS 2.0+ iPadOS 2.0+ Mac Catalyst 13.1+ tvOS 9.0+
This is probably a bug in IB as you see in Documentation that table view does not have any property for the shows Selection on touch. It is the property of tableview cell rather. So the checkbox should not be present in the IB. Probably you can file a bug with apple and see what they say about it.
For getting the effect you should do it like:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier2];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
}
}
Hope this helps.
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