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];
}
这实际上是默认行为。在什么情况下你有困难?