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中嘗試這個,是嗎? –