配列からのデータを使用してテーブルビューを作成しました。今、テーブルビューのすべての行の詳細が必要です。テーブルビューからレシピを選択すると、その特定のレシピの写真を上にして、そのレシピを準備するためのすべての材料と手順が表示されます。私はこの分野が初めてなので、親切に助けてください。
ここに「ViewController.m」があります
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
RecipeList = [[NSMutableArray alloc]init];
[RecipeList addObject:@"Chicken Kabab"];
[RecipeList addObject:@"Chicken Tikka"];
[RecipeList addObject:@"Chicken 65"];
[RecipeList addObject:@"Chicken Do Pyaza"];
CGRect frame = self.view.frame;
RecipeTable = [[UITableView alloc]initWithFrame:frame style:UITableViewStylePlain];
RecipeTable.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
RecipeTable.backgroundColor = [UIColor cyanColor];
RecipeTable.delegate = self;
RecipeTable.dataSource = self;
[self.view addSubview:RecipeTable];
[RecipeTable setScrollEnabled:YES];
[RecipeTable setUserInteractionEnabled:YES];
[RecipeTable setRowHeight:35];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return @"RECIPES";
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return RecipeList.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
}
cell.textLabel.text = [RecipeList objectAtIndex:indexPath.row];
return cell;
}
@end