Cell的點擊效果(點擊時纔有高亮鬆開則消失)
在celldidselect方法中實現
[tableView deselectRowAtIndexPath:indexPath animated:YES];
設置點擊的背景顏色
系統默認的三種顏色樣式
//無色
cell.selectionStyle = UITableViewCellSelectionStyleNone;
//藍色
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
//灰色
cell.selectionStyle = UITableViewCellSelectionStyleGray;
//自定義的顏色
/**
* 修改cell的控件屬性
* 此方法中可以修改系統默認cell的各個屬性
*/
//-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath實現
cell.selectedBackgroundView = [[UIView alloc] initWithFrame:cell.frame]; //這行代碼不能省略
cell.selectedBackgroundView.backgroundColor = [UIColor xxxxxx];