2009-10-20 5 views
1

나는 셀 액세서리를 바꾸기 위해
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

cellForRowAtIndexPath에서 서브 클래 싱 된 UITableViewCell 가져 오기


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

에서 호출했다. 이 잘 작동하지만 UITableViewCell 하위 클래스 필요가 결국. 서브 클래 싱 된 UITableViewCell을 얻는 올바른 방법은 무엇입니까? 대체 A : UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];



CustomCell: 0x4527ed0; baseClass = UITableViewCell


대체 B는 컴파일되지 않습니다.
CustomCell *cell = [tableView cellForRowAtIndexPath:indexPath];

미리 감사드립니다 !

답변

4

당신은 이런 식으로 캐스팅하고 CustomCell 객체

CustomCell *cell = (CustomCell *)[tableView cellForRowAtIndexPath:indexPath]; 
+0

완벽하고 고맙습니다. –

1

저스틴의 권리로 액세스 할 수 있어야합니다. 그래도 테이블을 설치 한 후에 액세서리보기를 변경해야합니까? 일반적으로 그러한 종류의 설정을 수행하는 가장 좋은 장소는 -tableView:cellForRowAtIndexPath:입니다.

관련 문제