Possible Duplicate:
How can I disable the UITableView selection highlighting?
When you tap a row in a UITableView
, the row is highlighted and selected. Is it possible to disable this so tapping a row does nothing?
Possible Duplicate:
How can I disable the UITableView selection highlighting?
When you tap a row in a UITableView
, the row is highlighted and selected. Is it possible to disable this so tapping a row does nothing?
Yes below code will disable user interaction , if you jut want to disable some certain cells you need to write some if - else methods
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.userInteractionEnabled = NO;
return cell;
}
If you have buttons or anything on your cell that still needs to be 'touchable', than just set the selection style to none:
cell.selectionStyle = UITableViewCellSelectionStyleNone;
If it just a cell with text than you can do like Space Dust suggested.
Also you can try this:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
//do ur stuff
}