問題描述
這是我們搜索任何應用時來自應用商店的圖片.我還想添加相同的滾動視圖概念,在該概念中它顯示當前圖像以及上一個和下一個圖像的小預覽.我能夠在 示例代碼.但是沒有找到當用戶點擊任何圖像時如何獲取索引或標記值的任何解決方案.這樣我就可以打開每個圖像的詳細信息頁面.如果有人對此有任何想法,請幫助我.
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.
提前致謝.
推薦答案
將手勢識別器添加到必要的圖像視圖中:
Add gesture recognizer to the necessary image view:
UITapGestureRecognizer *frameTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(frameTapGesture:)];
[_imgView addGestureRecognizer:frameTapGesture];
然后在手勢處理程序中訪問附加到的視圖手勢識別器:
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);
}
這篇關于從 imageview 點擊手勢獲取索引或標簽值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!