iOS アプリケーションの開発方法を学んでいますが、助けが必要な問題があります。
次のコードを使用して、解析中のクラスからデータを取得します。
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection: (NSInteger)section
{
return [recipes count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"RecipeCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
Recipe *recipe = [recipes objectAtIndex:indexPath.row];
UIImageView *imageView = (UIImageView*) [cell viewWithTag:100];
imageView.image = [UIImage imageNamed:recipe.imageFile];
UILabel *nameLabel = (UILabel*) [cell viewWithTag:101];
nameLabel.text = recipe.name;
UILabel *prepTimeLabel = (UILabel*) [cell viewWithTag:102];
prepTimeLabel.text = recipe.prepTime;
return cell;
}
私のテーブルには、レシピの準備に必要な時間の数値である準備時間の値が保持されています。ユーザーが準備時間に基づいてレシピを表示できるようにしたい. ユーザーが準備する最も速い食事を見ることができるボタンがあるとしましょう。if ステートメントと while ループを試してみましたが、あまり成功しませんでした。if (prepTime stringValue isEqualToString:@"30 mins"] などを試してから残りを実行しましたが、うまくいきませんでした。
どんな助けでも大歓迎です。私が言ったように、私はただ学んでいるので、あなたの説明を新しくするようにしてください.
ありがとうございました