cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
...
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
You could also try controlling the whole table, but it didn't work for me:
- (void)viewDidLoad
{
// Prevent message cell selection
self.chatTableView.allowsSelection = NO;
// HOX: not iPhone 2.2.1 compatible --> crash
[super viewDidLoad];
}
This is also supposed to work, but I recall I still got a selection flash:
- (NSIndexPath *) tableView:(UITableView *)_tableView willSelectRowAtIndexPath:(NSIndexPath *)_indexPath
{
// Return nil if you don't want the row selected.
// Hox: interferes with didSelectRowAtIndexPath
return nil;
}
Hi,
ReplyDeleteThanks for the tips, your first solution works fine for me as i only need to remove selection on some cell not on all the table.
cesar
If you want to disable cell selection for the entire table, simply use
ReplyDelete[tableView setAllowsSelection:NO];