問(wèn)題描述
這是我們搜索任何應(yīng)用時(shí)來(lái)自應(yīng)用商店的圖片.我還想添加相同的滾動(dòng)視圖概念,在該概念中它顯示當(dāng)前圖像以及上一個(gè)和下一個(gè)圖像的小預(yù)覽.我能夠在 示例代碼.但是沒(méi)有找到當(dāng)用戶點(diǎn)擊任何圖像時(shí)如何獲取索引或標(biāo)記值的任何解決方案.這樣我就可以打開每個(gè)圖像的詳細(xì)信息頁(yè)面.如果有人對(duì)此有任何想法,請(qǐng)幫助我.
This is the image from app store whenever we search for any app. I also want to add the same scrollview concept in which it show the currentimage with small preview of previous and next image. I am able to make this view with the help of Sample code. But didn't find any solution that how to get index or tagvalue when user tap any of the image. So that I would be able to open the detail page for each image. If Someone has idea about this please help me.
提前致謝.
推薦答案
將手勢(shì)識(shí)別器添加到必要的圖像視圖中:
Add gesture recognizer to the necessary image view:
UITapGestureRecognizer *frameTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(frameTapGesture:)];
[_imgView addGestureRecognizer:frameTapGesture];
然后在手勢(shì)處理程序中訪問(wèn)附加到的視圖手勢(shì)識(shí)別器:
Then in the gesture handler get access to the view gesture recognizer attached to:
- (void)frameTapGesture:(UITapGestureRecognizer*)sender
{
UIView *view = sender.view; //cast pointer to the derived class if needed
NSLog(@"%d", view.tag);
}
這篇關(guān)于從 imageview 點(diǎn)擊手勢(shì)獲取索引或標(biāo)簽值的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!