2013-03-24 7 views
1

셀 데이터를 표시해야합니다. 사실 내가 코드를 디버그하면 cell.label.text에 올바른 값이 있지만 시뮬레이터에 아무 것도 표시되지 않는다는 것을 알 수 있습니다. numberOfRowsInSection 메서드에서 행 수를 설정했습니다.사용자 정의 셀 데이터가 표시되지 않습니다.

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
     static NSString *identifier = @"Cell"; 
     LogTableCell *cell = (LogTableCell *)[tableView dequeueReusableCellWithIdentifier:identifier]; 
     CGRect frame1 = [ self.view frame]; 
     frame1.origin.x=22.0f; 
     frame1.origin.y=55.0f; 

     frame1.size.width = 298.0f; 
     frame1.size.height= 425.0f; 
     [self.view.superview setFrame:frame1]; 
     int btnWidth = ((self.view.frame.size.width-16)/3); 


     if(cell == nil) 
     { 
      cell = [[LogTableCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]; 
     } 
     LogItem *lg = [[LogItem alloc]init]; 

     lg = [arrLogs objectAtIndex:indexPath.row ]; 

     NSLog(@"%d",indexPath.row); 
     cell.lblname.textColor=[UIColor whiteColor]; 
     cell.lblsubtype.textColor=[UIColor whiteColor]; 
     cell.lbltime.textColor=[UIColor whiteColor]; 
     cell.lblname.font=[UIFont fontWithName:@"Merriweather" size:15.0]; 
     cell.lblsubtype.font=[UIFont fontWithName:@"Merriweather-Light" size:13.0]; 
     cell.lbltime.font=[UIFont fontWithName:@"Merriweather-Light" size:13.0]; 

     UIImageView *imageview = [[UIImageView alloc] initWithFrame:CGRectMake(1, cell.contentView.frame.size.height, 298.0,2)] ; 

     imageview.image = [UIImage imageNamed: @"lineseperator.png"]; 
     [cell.contentView addSubview:imageview]; 

     cell.lblname.text = lg.name; 
     NSLog(@"%@",lg.name); 
     [[cell imgtype] setImage:[UIImage imageNamed:lg.imagetype]]; 

     if([lg.subtype length] == 0){ 
      NSLog(@"%@",lg.subtype); 
      cell.lblsubtype.text = lg.time; 
      cell.lbltime.text = @""; 
     } 
     else{ 
      NSLog(@"%@",lg.subtype); 
      cell.lblsubtype.text = lg.subtype; 
      cell.lbltime.text = lg.time; 
     } 


    return cell; 
} 
+0

어디에서 셀의 라벨을 인스턴스화합니까? 귀하의 질문은 'cell.label.text'을 참조하지만 당신의 코드에서 어디에도 보이지 않습니다. 또한 코드의 가독성을 극대화 할 수있는 친숙한 팁 - [이 훌륭한 문서는 여기에 있습니다.] (https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html)를 숙지하십시오. –

+0

cell.label.text는 example.Actually 모든 레이블을 의미 cell.lblname.text, cell.lblsubtype.text, cell.lbltime.text – Pal

답변

0

셀에 추가하는 이미지 뷰는 다른 모든 콘텐츠를 포함합니다. 크기를 조정하거나 위치를 변경하거나 기존의 cell.imageView를 대신 사용해야합니다.

+0

어떻게 그 일이 일어날 지 모르겠다 - 그것은 단지 두 개의 픽셀 높이 그리고 세포의 바닥에. –

+0

예, 단지 2 픽셀 높이, 라인 파이터. – Pal

관련 문제