2011-05-16 5 views
0

UITableView에서 사용자 지정 셀에 값을 설정하려고합니다. 그러나 내가 그것을보고있을 때 아무런 오류가 없지만 UILabel에 나의 가치가 정해지지 않았다!Iphone - 사용자 지정 셀 - UILabel을 설정할 수 없습니다.

및 아이디어?

되는 사용자 정의 셀 : 내 jQuery과에

@interface InscriptionCustomCell : UITableViewCell { 

IBOutlet UILabel *titreCell; 
IBOutlet UITextField *contenuCell; 

}

보기 :

// Customize the appearance of table view cells. 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath { 

static NSString *CellIdentifier = @"InscriptionCustomCell"; 

InscriptionCustomCell *cell = (InscriptionCustomCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 

    NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"InscriptionCustomCell" owner:self options:nil]; 

    for (id currentObject in topLevelObjects){ 
     if ([currentObject isKindOfClass:[UITableViewCell class]]){ 
      cell = (InscriptionCustomCell *) currentObject; 
      break; 
     } 
    } 
} 
cell.selectionStyle = UITableViewCellSelectionStyleNone; 

if(indexPath.section == 0) 
{ 
    [cell.titreCell setText:[model.listModuleInfoPerso objectAtIndex:indexPath.row]]; 
    [cell.contenuCell setPlaceholder:[model.listModuleInfoPerso objectAtIndex:indexPath.row]]; 
}else { 
    [cell.titreCell setText:[model.listModuleInfoSupp objectAtIndex:indexPath.row]]; 
    [cell.contenuCell setPlaceholder:[model.listModuleInfoSupp objectAtIndex:indexPath.row]]; 
} 
return cell; 

은} pratikshabhisikar처럼

+0

왜 휴식이 있습니까? –

+1

레이블이 펜촉에서 적절한 콘센트에 연결되어 있는지 확인하십시오. –

답변

0

는 콘센트에에 펜촉에 레이블을 연결했다 너의 수업.

그런 다음 UILabel.text 속성을 사용하여 레이블 텍스트를 설정하십시오.

cell.yourCustomLabel.text = @"text"; 

또는

NSString * labelText = [something...]; 
cell.yourCustomLabel.text = labelText; 

질문을 만들 때 또한 태그의 표준 애플 용어를 사용하십시오

. 예 : ios, uikit 등

+1

블로그에 맞춤형 셀 사용에 대한 게시물을 작성했습니다. 아마도 유용 할 것입니다. http://effectivemobility.blogspot.com/2011/05/using -custom-cells-in-your-uitableview.html – arclight

관련 문제