Reputation: 7058
I have implemented cell.selectionStyle = UITableViewCellSelectionStyleNone;
both in:
-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath { }
and in:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { }
But each row keeps geting blue selection first time it is clicked. How can I disable the selection entirely?
The code goes like this (The cell is custom):
-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
CategoryCell *cell = (CategoryCell*)[tableView cellForRowAtIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return nil;
}
Upvotes: 0
Views: 1210
Reputation: 17186
cell.selectionStyle = UITableViewCellSelectionStyleNone;
You should do it in cellForRowAtIndexPath
Upvotes: 0
Reputation: 89509
Turn the "allowsSelection
" property off for your table.
You can do this programatically or within the XIB / storyboard file.
Upvotes: 0
Reputation: 21221
Implement it in cellForRowAtIndexPath
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//create cell
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
Upvotes: 2