- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"activityTableViewCell"; activityTableViewCell *cell = (activityTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[activityTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } cell.selectionStyle=UITableViewCellSelectionStyleNone;//設置cell點擊效果 return cell; }
或者
//重寫 cell 點擊事件 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath { //當離開某行時,讓某行的選中狀態消失 [tableView deselectRowAtIndexPath:indexPath animated:YES]; }