2010-04-06 2 views

답변

1

두 가지 방법이 있지만 관련 XIB 파일로 UITableViewCell 파생물을 만드는 경향이 있습니다. 단추와 레이블을 포함하도록 Interface Builder에서 XIB를 수정하십시오. 해당 객체를 UITableViewCell 클래스의 IBOutlets 및 IBActions에 연결합니다.

당신이 당신의 cellForRowAtIndexPath을 구현할 때이처럼있는 UITableViewCell XIB 파일에서 최상위 레벨의 객체 잡을 수

NSArray * topLevelObjects = [[NSBundle mainBudnle] loadNibNamed:@"YourCellNib" owner:self options:nil]; 
cell = [topLevelOjects objectAtIndex:0]; 

당신은 다음있는 UITableViewCell 클래스에 휴대 객체를 캐스팅 할 수 있습니다

YourCellClass * thingCell = (YourCellClass*)cell; 

을 그런 다음 YourCellClass를 사용하여 UITableView에서 셀을 제어 (및 이벤트 수신) 할 수 있습니다.

관련 문제