iphone - 编辑时iPhone UITableViewCell selectionStyle中的selectionStyle?

标签 iphone ios objective-c xcode

<分区>

Possible Duplicate:
How can I disable the UITableView selection highlighting?

当您点击 UITableView 中的一行时,该行会突出显示并被选中。是否可以禁用此功能以便点击一行什么都不做?

最佳答案

是的,下面的代码将禁用用户交互,如果您只想禁用某些特定的单元格,您需要编写一些 if - else 方法

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    cell.userInteractionEnabled = NO;

    return cell;
}

关于iphone - 编辑时iPhone UITableViewCell selectionStyle中的selectionStyle?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14262796/

相关文章:

iphone - TouchsAnyObject 没有像我想象的那样工作

iphone - 不调用 textViewDidEndEditing

iphone - 在 iOS 中朗读文本

iphone - objective-c 将数字取整

ios - 查询包含两个键的 couchbase ios View 时使用通配符

iphone - iOS:如何在输入文本字段后发送键盘

ios - 如何基于uitableview动态增加scrollview的高度

ios - 第二个选项卡中的 UICollectionView 导致第一个选项卡中的 UICollectionView 崩溃应用程序

ios - 对下层对象执行手势

objective-c - 自定义描述方法不起作用