我正在使用自定义的TableView,当我点击一个单元格并且它突出显示时我遇到了问题。单击单元格后,它会突出显示并转到另一个视图。问题是,当我返回TableView屏幕时,单元格仍然会突出显示。
这是我的代码:
在cellForRowAtIndexPath
中cell.backgroundView = [[[UIImageView alloc] initWithImage:[UIImage
imageNamed:@"CustomCell.png"]] autorelease];
cell.selectedBackgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"CellHighlighted.jpg"]] autorelease];
在didSelectRowAtIndexPath
中 Characteres *vCharacters = [[Characters alloc] initWithNibName:@"Characters" bundle:[NSBundle mainBundle]];
//vCharacters.selectedCountry = selectedCountry;
[self presentModalViewController:vCharactersr animated:YES];
[vCharacters release];
vCharacters = nil;*
答案 0 :(得分:2)
您需要将其添加到didSelectRowAtIndexPath:
[tableView deselectRowAtIndexPath:indexPath animated:NO];
这将取消选择该行。