2012-08-01 3 views

답변

0
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
static NSString *identifier = @"CellIdentifier"; 
CustomCellName *cell = (CustomCellName *)[tableView dequeueReusableCellWithIdentifier:identifier]; 
if(!cell) { 
cell = [[CustomCellName alloc] initWithStyle:UITableViewStyleDefault reusableIdentifier:identifier]; 
} 
cell.textLabel.text = [nameArray objectAtIndex:indexPath.row]; 
cell.subtextLabel.text = [numberArray objectAtIndex:indexPath.row]; 
return cell; 
} 

의 서브 클래스 (오히려 내 아이폰의 입력에이 모든 아웃)하지만, 코드를 현명하게 사용해야합니다.

textLabel라는 = 속성 이름 귀하의 사용자 정의 셀 클래스 레이블 설정 당신이 당신의 사용자 정의 셀 클래스 레이블 설정 subtextLabel = 속성 이름이 도움이

희망!

0

UITableViewCell의 하위 클래스 여야하는 새 파일을 만듭니다. 여기서 원하는 곳에 표시 할 수있는 2 개의 레이블을 작성할 수 있습니다.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *theID = @"TableViewCell"; 
    CustomCell *cell = (CustomCell*)[tableView dequeueReusableCellWithIdentifier:theID]; 

return cell; 
} 

가 여기에 CustomCell 내가이 작업을 수행하기 위해 컴퓨터에 아니에요있는 UITableViewCell

위의 코드는 테스트되지 않은 상태입니다
관련 문제