スクロールテーブルの場合、チェックマークはhideです。私はReusing Cellのために知っているが、私は修正する方法を知らない。 Plsは私を助ける。ここに私のコードは次のとおりです。スクロール時にtableViewCellのチェックマークが隠されています
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *identifier = @"Cell";
StudentTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];
if (cell == nil) {
cell = [[StudentTableViewCell alloc] init];
}
if (_btnCancel.hidden == NO) {
cell.accessoryType = UITableViewCellAccessoryNone;
} else {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
return cell;
}
私がチェックしdidSelectRowAtIndexPathにオフに変更します。
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell* cellCheck = [tableView cellForRowAtIndexPath:indexPath];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
if (_btnCancel.hidden == NO) {
if (cellCheck.accessoryType == UITableViewCellAccessoryNone) {
cellCheck.accessoryType = UITableViewCellAccessoryCheckmark;
TeacherInfo *courseStudent = studentQuitArray[indexPath.row];
[dict setObject:courseStudent.id_user forKey:@"student_id"];
[studentDetail addObject:dict];
} else {
cellCheck.accessoryType = UITableViewCellAccessoryNone;
[studentDetail removeObject: studentQuitArray[indexPath.row]];
}
}
}
_btnCancel.hidden = YESの場合はどこですか? –
私の意見はbtnを選択しました。 Nomorl:ボタンキャンセルはhiddeで、セルは詳細です。私がそれをクリックすると、show buttonCancelを表示し、cellはAccessoryNoneです。 _btnCancel.hidden = YESセルの詳細を表示するかセルを選択するかをチェックするだけです。 – Rin