Я создал пользовательскую ячейку, имеющую метку и изображение. В ячейке пользовательской ячейки есть класс customCellClass с идентификатором CustomTableCell. это результат снимок экрана, не было принято никаких данных, но пользовательские таблицы появляется как вы можете видетьCustomCell: невозможно отобразить данные на главном экране
это является .m файл, где им получать данные из массива * имя. посмотрите, что мне не хватает. и btw im пытается [self.tableView reloadData]; in viewdidload, но я не знаю, но я не могу инициировать это.
@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
Кстати это настраиваемая таблица клеток им с помощью
ha Вы назначили делегата и источник данных для таблицы? –
datacource и делегат ......? –
Вы уверены, что ваши выходные соединения верны? –