別のスクロール ビューで開く必要がある特定の画像をタップ/クリックすると、画像がコレクション ビュー グリッドに表示されるプログラムを作成しています。コレクション ビューで動的にセルを作成しています。誰もそれについて何か考えがありますか? 前もって感謝します。
質問する
699 次
5 に答える
1
タップ ジェスチャを使用する
UITapGestureRecognizer *PressRecognizer1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handlePress:)];
[PressRecognizer1 setNumberOfTouchesRequired:1];
[imageview addGestureRecognizer:PressRecognizer1];
このメソッドでコードを記述します
-(void)handlePress:(UITapGestureRecognizer*)PressRecognizer {
NSLog(@"working");
//Add your code here for click on particular image
}
于 2013-03-13T12:24:58.513 に答える
0
didSelectItemAtIndexPath
デリゲートメソッドを使用する必要があります。
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
// TODO: Here you need to allocate the next view and pass the image then show the view
}
于 2013-03-13T12:31:42.857 に答える
0
単純に画像を追加して使用しないのはなぜUIButton
ですか?
[button setBackgroundImage:[UIImage imageNamed:@"img.png"] forState:UIControlStateNormal];
[button addTarget:self action:@selector(callNewController:) forControlEvents:UIControlEventTouchUpInside];
于 2013-03-13T12:29:10.047 に答える
0
UICollectionViewDelegate の次のメソッドを実装する必要があります
- (void)collectionView:(UICollectionView *)collectionView
didSelectItemAtIndexPath:(NSIndexPath *)indexPath
ユーザーがアイテムをタップすると、メソッドが呼び出されます。
委任を設定することを忘れないでください。
于 2013-03-13T12:27:19.370 に答える
0
男はこのコードをダウンロードするだけです
それを開始し、 DetailViewController.m に
プログラムでself.imageView.image = self.image;
配置しscrollView
て追加imageView
します
于 2013-03-13T12:47:07.830 に答える