tableviewcell을 사용하여 앱을 프로그래밍하고 있습니다. 셀을 만지면 다른 뷰 컨트롤러로 이동하여 스위치를 활성화하고 plist 파일에이 상태를 저장합니다. Back to tableviewcell plist 파일에서 정보를 읽고 터치 및 활성화 된 셀의 배경색을 업데이트합니다. 문제는 셀을 볼 수있는 경우 탐색 버튼이 배경색을 표시하지 않지만 다시 tableview 셀로 돌아갈 때입니다. 아래로 스크롤하면 색상 셀이 업데이트됩니다. reloadData 메서드를 시도했지만 성공하지 못했습니다. IOS API에서 보이는 셀은 reloadData 메소드로 업데이트됩니다. 미리 감사드립니다. 다른보기 컨트롤러에서 전환 할 때 이미로드 셀이 표시 될 때 willDisplayCell
으로tableviewcell에서 시각적 셀을 업데이트하지 않습니다.
- (void)viewWillAppear:(BOOL)animated {
controladorRegistre = [[ControladorRegistres alloc]initRegistreAmbCategoria];
[self.tableCategories reloadData];
[super viewWillAppear:animated];
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath
{
//Pinta la celda si esta activada
registre = [controladorRegistre getRegistreCategoria:cell.textLabel.text];
BOOL estaActivat = [[registre objectForKey:@"estaActivat"] boolValue];
if (estaActivat) {
[cell setBackgroundColor:[UIColor redColor]];
}else{
cell.backgroundColor = [UIColor whiteColor];
}
}
'willDisplayCell'이 호출되는지 확인 했습니까? – Mundi
그것이라고 부르지 만, 하위 뷰에서 돌아 왔을 때, 아래로 스크롤 할 때까지, 그러면 컬러 셀이 업데이트됩니다. – Sep