How can I set the UITableView\'s cell property to be unselectable? I don\'t want to see that blue selection box when the user taps on the cell.
To make certain row unselected you have to make some changes in two methods of UITableView delegate.
In the method below
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
after allocation of the cell, write the code below
if(indexPath.row == someCellNumber) cell.selectionStyle =UITableViewCellSelectionStyleNone;
The above code will prevent highlighting the cell, if somehow user tries to selects.
in this delegate method below
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if(indexPath.row == someCellNumber) return;
//for other cells write the code below...
}
if you don't write if(indexPath.row == someCellNumber) return; row will still be selected and there is a chance of app crash