Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/43.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UITableViewCell-将其设置为选中/高亮显示。。。并保持选中/突出显示状态_Iphone_Objective C_Cocoa Touch_Uitableview - Fatal编程技术网

Iphone UITableViewCell-将其设置为选中/高亮显示。。。并保持选中/突出显示状态

Iphone UITableViewCell-将其设置为选中/高亮显示。。。并保持选中/突出显示状态,iphone,objective-c,cocoa-touch,uitableview,Iphone,Objective C,Cocoa Touch,Uitableview,我想在打电话后让UITableViewCell保持亮起(蓝色) cell.selected = YES; 这可能吗?我是否需要换一种方式(如在not单元格中。selected)假设您没有以某种方式明确返回NO tableView DidSelectRowatineXpath:indexPath,您不需要执行任何操作。这是默认行为。您可以使用 [self tableView:self.tableView selectRowAtIndexPath:[NSIndexPath indexPathFor

我想在打电话后让
UITableViewCell
保持亮起(蓝色)

cell.selected = YES;

这可能吗?我是否需要换一种方式(如在not
单元格中。selected

假设您没有以某种方式明确返回NO tableView DidSelectRowatineXpath:indexPath,您不需要执行任何操作。这是默认行为。

您可以使用

[self tableView:self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForForRow:row inSection:section]];

选择时,可以将选择样式设置为保持蓝色,如下所示:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
    cell.selectionStyle = UITableViewCellSelectionStyleBlue;
}
并确保您没有取消选择单元格:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    //  This is what you DO NOT want to do
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
}

这实际上是默认行为。在什么情况下你有困难?