Я попытался найти несколько руководств по заполнению табличных представлений, но все, что я нашел, это старые и устаревшие видео. Я попытался сделать это из немного более недавнего, и это не сработает. У меня
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"];
[chemarray addObject:@"2"];
[chemarray addObject:@"test"];
[chemarray addObject:@"3"];
[chemarray addObject:@"science"];
}
и
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [chemarray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
cell.textLabel.text = [chemarray objectAtIndex:indexPath.row];
return cell;
}
в соответствии с этим руководством, при запуске он должен отображать элементы в моем массиве, но для меня это не так! Кто-нибудь знает, как это исправить?