2013-05-11 2 views
0

내 응용 프로그램에서 사용자 지정 셀을 사용했습니다. 그 안에는 버튼, 이미지, 텍스트 필드, 레이블과 같은 많은 필드가 있습니다. 나는 indexpath.sectionindexpath.rowUITableView 사용자 지정 셀의 셀 재사용 문제

를 표시해야 그 중

나는

cell.sectionLabel.text = [NSString stringWithFormat:@"%d", indexPath.section];  
cell.rowLabel.text = [NSString stringWithFormat:@"%d", indexPath.section]; 

으로 시도했지만 표시된 값으로 인해 재사용 메커니즘에 잘못된 시간입니다.

이 문제를 해결하는 방법?

+1

. 또한 이것이 모두 코드로되어 있는지 또는 IB 또는 스토리 보드를 사용하고 있는지 지정하십시오. – rmaddy

답변

1

다른 코드를 공유 할 수도 있습니다. 한편

(즉 전통적인 방법)

당신은`cellForRowAtIndexPath` 방법을 보여줄 필요가
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

    //dequeue the cell here... 

    if(!cell) { 
     //create the cell here... 
    } 

    cell.sectionLabel.text = [NSString stringWithFormat:@"%d", indexPath.section]; 
    cell.rowLabel.text = [NSString stringWithFormat:@"%d", indexPath.row]; // set row here 

    return cell; 
} 
관련 문제