2010-08-11 5 views
0

헤이 사람들이 테이블 뷰에 문자열 배열을로드하는 데 문제가 있습니다. 이미 수행 한 작업은 정보를 구문 분석하고 statues1이라는 요소의 mutablearray에 필요한 데이터를 저장했습니다. 할 일은 lues를 사용자 정의하여 테이블 뷰에 statues1을로드하는 것입니다. 사용자가 모든 값을 볼 수 있습니다. 이제는 테이블 뷰를로드 할 때 테이블 뷰를로드 할 때 오류가 발생합니다. "BAD EXCESS", 도와주세요. 이?가변 배열에서 테이블 뷰로드

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

    int counter=indexPath.row; 

    NSString *CellIdentifier = [NSString stringWithFormat:@"%d",counter]; 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
     cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 
     cell.selectionStyle=UITableViewCellSelectionStyleNone; 

     UIImageView *imgViewBack=[[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 100.0)]; 
     imgViewBack.image=[UIImage imageNamed:@"black-_image.png"]; 
     [cell.contentView addSubview:imgViewBack]; 

     if(statuses1) 
     { 
      UILabel *lblTitle=[[UILabel alloc] initWithFrame:CGRectMake(100.0, 10.0, 200.0, 20.0)]; 
      lblTitle.text=[statuses1 objectAtIndex:indexPath.row]; 
      [cell.contentView addSubview:lblTitle]; 
      [lblTitle release]; 
     }       
     //[cell.contentView addSubview:btnRowButton]; 
    }    
    return cell; 
} 

답변

0

대신에 각 셀에 대한 새 레이블보기를 추가 할 수 있습니다

cell.detailTextLabel.text = [statuses1 objectAtIndex:indexPath.row]; 

잘 모르겠지만 그 이후에 출시되면 오류가 발생할 수 있습니다. 당신은 hte traceback을 체크하여 어떤 호출이 그것을 일으켰는지 알아낼 수있다. (버그가있는 작은 노란 버튼)

+0

'lblTitle'의 OP의'release'는 그가'alloc/init '. –

+0

하지만 테이블 뷰에서 여러 개의 lables를 표시해야하므로 사용자 정의해야합니다. 위 결과를 적용하면 "BAD EXCESS" –

+0

@ Jacob, 맞습니다. @Prash, 추적을 보셨습니까? (그것은 응용 프로그램이 실행 중일 때 Shift-Command-Y입니다) –

관련 문제