2013-03-14 1 views
0

특정 셀에 액세스하는 데 어려움이있는 것처럼 보입니다. 테이블 뷰에서 객체를 선택할 때 해당 객체 중 하나를 변경해야합니다. reloadData를 처음부터 다시 호출하는 것보다 효율적인 방법이 있어야합니다. 그게 내가 테이블 셀을 다른 셀로 만들 수있는 유일한 방법이기 때문에 하나를 선택했을 때 재구성하면된다. 감사합니다 모든 도움 :선택한 경우 셀 객체를 어떻게 액세스 할 수 있습니까?

[self updatePreferences]; 
[tableView reloadData]; 

을 위해 이것은 내가 그것을 테이블 셀과의 상호 작용을 처리하는 방법에 기압이 전부입니다.

+0

당신은 이 http://stackoverflow.com/questions/4448321/is-it-possible-to-refresh-a-single-uitableviewcell-in-a-uitableview 참조 tableView.reloadRowsAtIndexPaths 를 호출 할 수 있습니다 –

답변

0

다음 코드를 사용하십시오. 단일 셀을 다시로드하려면 다음을 수행하십시오.

NSArray *array = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:row inSection:section]]; 
[self.tableView reloadRowsAtIndexPaths:array withRowAnimation:UITableViewRowAnimationNone]; 
0

또한 셀을 맞춤 설정하고 업데이트 또는 새로 고침과 같은 방법을 추가 할 수도 있습니다.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    CustomCell *cell = [tableView cellForRowAtIndexPath:indexPath]; 
    [cell refresh]; 
} 
관련 문제