cell.selectionStyle = UITableViewCellSelectionStyleGray;
,并使用代码高亮显示一行:
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection: 0];
[self.tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone
高亮颜色总是很蓝,即使我设置为灰色。如果我设置:
cell.selectionStyle = UITableViewCellSelectionStyleNone;
它工作正常,没有高光。但只是不适用:
cell.selectionStyle = UITableViewCellSelectionStyleGray;
它只是显示蓝色而不是灰色。任何想法?谢谢。
请张贴代码,包括完整的方法体您在哪里设置选择颜色并执行选择。 –
你不是偶然在iOS 7中尝试这个,是吗? –