单击单元格时,我的 TableView 没有将单元格着色为蓝色。InterfaceBuild 有
Selection: Single Selection
Show Selection on Touch : YES
当我点击表格时,我的表格视图控制器中的代码就会运行
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// code
}
编辑
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
NSString *item = (NSString *)[songList objectAtIndex:indexPath.row];
cell.textLabel.text = item;
return cell;
}