다른 제목 표제에 대한 체크 표시를 통해 UITableView에 필터를 구현하고 있습니다.같은 화면으로 돌아 가면 UITableView의 체크 표시가 사라 집니까?
선택한 셀에 따라 쿼리가 로컬 데이터베이스에서 실행되고 결과가 나타납니다. 배열에 필터 결과를 저장하고 을 전달하고이 배열을 다른 uitableviewview에 밀어 넣어 결과를 표시합니다.
모달 세구를 사용하여 필터 화면으로 이동합니다.
하지만 문제는 필터 화면으로 돌아 가면 선택한 체크 표시가있는 셀이 사라집니다.
다음은 행을 선택하는 내 코드입니다 :-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
long sec = [indexPath section];
if(sec==0){
if(cell.accessoryType == UITableViewCellAccessoryNone) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
[sportsSelectedRows addObject:indexPath];
}
else {
cell.accessoryType = UITableViewCellAccessoryNone;
[sportsSelectedRows removeObject:indexPath];
}
}
else if(sec==1){
if(cell.accessoryType == UITableViewCellAccessoryNone) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
[areaSelectedRows addObject:indexPath];
}
else {
cell.accessoryType = UITableViewCellAccessoryNone;
[areaSelectedRows removeObject:indexPath];}
}
else if(sec==2){
cell.tag = indexPath.section;
for (UITableViewCell *cell in [tableView visibleCells]) {
if (cell.accessoryType != UITableViewCellAccessoryNone && cell.tag == indexPath.section) {
cell.accessoryType = UITableViewCellAccessoryNone;
}
}
if(cell.accessoryType == UITableViewCellAccessoryNone) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
[daySelectedRows removeAllObjects];
[daySelectedRows addObject:indexPath];
}
else {
cell.accessoryType = UITableViewCellAccessoryNone;
[daySelectedRows removeObject:indexPath];}
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
당신은이 문제를 해결하는 데 도움이 수 없습니다.
가능한 복제본 [UINavigationController 하위 화면에서 돌아 왔을 때 UITableView 선택된 행을 어떻게 유지합니까?] (http://stackoverflow.com/questions/6795214/how-do-i-maintain-the-uitableview-selected -row-when-returning-from-a-uinavigatio) – jlehr
감사합니다 @jlehr 나는 이것을 점검하고 다시 연락 할 것입니다. –