2012-04-03 44 views
-2

可能重复:
HOw to enable and disable cells in uitableview如何禁用和启用按钮的UITableView细胞中选择单击

我是新iphone .. 我做了一个项目,最初的细胞的表格将被禁用,点击一些按钮后,单元格选择被启用。

禁用单元格应该是。人们现在可以看到这是选择和按钮click..again用户禁用后可以看到,CEL选择启用...

怎么可以

+0

它是关于完全选择或取消选择特定单元格或整个表。 – rptwsthi 2012-04-03 04:45:29

回答

2

禁用选择结合使用:

[cell setSelectionStyle:UITableViewCellSelectionStyleNone]; 

以及用于使选择使用:

[cell setSelectionStyle:UITableViewCellSelectionStyleDefault]; 
+0

不工作... – tong 2017-11-19 14:19:33

1

要禁用选择小区的 cell.userInteractionEnabled = NO; 使用户感觉单元格被禁用 cell.selectionStyle = UITableViewCellSelectionStyleNone;

0
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 


    static NSString *CellIdentifier = @"Cell"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
     cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; 
    } 

    cell.userInteractionEnabled = NO; 
    return cell; 
} 

使用任何条件可以禁用启用pericular cell。

0

在按钮的操作点击获得的cell的实例,并设置其user interaction或真或假,只要你想这样的 -

UITableViewCell *cellView = (UITableViewCell*)[tblView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:0]]; 

[cellView setUserInteractionEnabled:FALSE]; 
0

我得到了答案..

显示它为禁用cell ...

cell.label.alpha = 0.43f(constant value) and set table interaction = NO;

和用于制造它使

cell.label.alpha = 1.0F 并设置表相互作用=是;

相关问题