アプリの設計と Objective-C は初めてです。私は、食べ物の詳細、食べ物の名前、調理時間、および画像につながるファイル名を含むいくつかの食べ物を配列に保存した単純な食べ物アプリを書いています。
字幕を機能させようとしていますが、表示されません。私は他のさまざまな投稿を読み、いくつかの回答を実装しようとしましたが、どれもうまくいきませんでした.
これは私のコードですが、明らかに間違っている場合はお知らせください。ありがとうございました。
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"FoodCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (cell == nil){
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
Food *current = [foodArray objectAtIndex:indexPath.row];
[cell.textLabel setText:[current name]];
[[cell detailTextLabel] setText:@[current cookTime]];
cell.imageView.image = [UIImage imageNamed:[current fileName]];
return cell;
}