레이블과 imageView가있는 사용자 정의 셀을 만들었으므로 사용자 정의 셀 셀에는 CustomTableCell 식별자가있는 customCellClass 클래스가 있습니다. 이, 데이터가 전달되지 않은 결과 스크린 샷입니다하지만 u는CustomCell : 기본보기에서 데이터를 표시 할 수 없습니다.
이 메신저 배열 * 이름에서 데이터를 얻는하는 .m 파일입니다을 볼 수있는 사용자 정의 테이블이 나타납니다. 내가 무엇을 놓치고 있는지보십시오. btw im [self.tableView reloadData] 시도 중입니다. viewdidload에서하지만 난 y를 몰라,하지만 난 그럴 수없는 시작.
@synthesize name = _name;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.name = [NSArray arrayWithObjects:@"First", @"Second", @"Third",@"First", @"Second", @"Third",@"First", @"Second", @"Third",@"First", @"Second", @"Third",@"First", @"Second", @"Third", nil];
// self.name = [[NSArray alloc]initWithObjects:@"First", @"Second", @"Third", nil];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [self.name count];
}
-(void) viewDidAppear:(BOOL)animated{
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"CustomTableCell";
customCellClass *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell = [[customCellClass alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"CustomTableCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.nameLabel.text = [self.name objectAtIndex:indexPath.row];
cell.imageThumb.image = [UIImage imageNamed:@"images.jpeg"];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 78;
}
@end
은 BTW이
헥타르 델리게이트와 데이터 소스를 테이블에 할당 했습니까 ?? –
datacource 및 delegate ......? –
콘센트 연결이 정확한가요? –