テーブル ビューにデータを入力する方法についていくつかのチュートリアルを検索してみましたが、古い古いビデオしか見つかりませんでした。少し最近のものからやってみましたが、うまくいきません。私は持っている
- (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;
}
このチュートリアルによると、実行すると、配列に項目が表示されるはずですが、私にとってはそうではありません! これを修正する方法を知っている人はいますか?