1

tableViewが編集モードでない場合、ユーザーがセルに触れて強調表示できないようにしたくありません。ただし、allowsSelectionDuringEditingYES に設定しているため、ユーザーは編集モードでセルを選択できます。

編集モードのときにセルの強調表示されたビューまたは色のみを表示するにはどうすればよいですか?

4

3 に答える 3

-1
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  static NSString *CellIdentifier=@"Cell";
  UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if(cell==nil){
     //YOUR inits
  }

  if(self.editing){
    [cell setSelectionStyle:UITableViewCellEditingStyleNone];
  }else
    [cell setSelectionStyle:UITableViewCellEditingStyleBlue];

  return cell;

}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  if(self.editing)return; //NO ACTION
}
于 2013-04-29T05:01:52.627 に答える