1

我创建了一个仅供查看的表格。任何被点击的表格行的自动突出显示有点不必要和误导。如何关闭单击时的行突出显示?

4

2 回答 2

2

您可以覆盖该UITableViewCell.SelectionStyle属性以返回任何UITableViewCellSelectionStyle值,其中包括None.

于 2013-06-21T21:13:14.203 回答
1

每当您创建一个新单元格时,请设置 cell.selectionStyle = UITableViewCellSelectionStyleNone;

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

    static NSString *CellIdentifier = @"Cell"; 
    UITableViewCell *cell = [tableView_ dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) 
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }

 return cell;
}
于 2013-06-22T04:17:49.333 回答