私は現在、ユーザーが「Apple」を選択したときにプロジェクト内のイメージをAppleのイメージビューにロードすることを希望する単純なグループ化されたUITableViewを作成しています。UITableViewとアイテムの選択
私はインターネット上でいくつかの例を見ましたが、そこに他に何があるかを見極めようとしています。
ご意見をいただければ幸いです。ありがとう。
私は現在、ユーザーが「Apple」を選択したときにプロジェクト内のイメージをAppleのイメージビューにロードすることを希望する単純なグループ化されたUITableViewを作成しています。UITableViewとアイテムの選択
私はインターネット上でいくつかの例を見ましたが、そこに他に何があるかを見極めようとしています。
ご意見をいただければ幸いです。ありがとう。
のどちらかがcell.imageView.highlightedImage
設定、またはdidSelectRowAtIndexPath
方法では、いくつかの[UIImage imageNamed:@"myImage.png"]
にゼロからcell.imageView.image
を変更:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *kCustomCellID = @"com.me.foo.cell";
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCustomCellID] autorelease];
cell.textLabel.highlightedTextColor = [UIColor blueColor];
cell.imageView.image = nil;
cell.imageView.highlightedImage = [UIImage imageNamed:@"myImage.png"];
return cell;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(iPadRootViewControllerTableCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.imageView.contentMode = UIViewContentModeScaleAspectFit;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Do this if you didnt set the highlightedImage in cellForRowAtIndexPath
// [self tableView:tableView cellForRowAtIndexPath:indexPath].imageView.image = [UIImage imageNamed:@"myApple.png"];
}
何をwillDisplayCell:forRowAtIndeaPath:ん? – user523234
セルが表示される直前に呼び出されます。それは、コンテンツの変更ではなく、セルのUI変更を行う場所です。 – chown
あなたがここで何を学ぼうとしているのかははっきりしない。テーブルの選択( '-tableView:didSelectRowAtIndexPath:')を検出し、 'UIImageView'(' -setImage: ')で画像を表示する操作は簡単です。どこに問題がありますか?どのようなサンプルを見ましたか?他のソリューションを探したいというサンプルはどうですか? – jemmons