开发者

How to show XML parsed images by using Tap gestures in iphone?

开发者 https://www.devze.com 2023-04-12 23:36 出处:网络
I am making an App in which i am parsing an XML and storing the url of images in an array. Now i have to show all that images on next View Controller using Tap Gestures and w开发者_如何转开发hen i cl

I am making an App in which i am parsing an XML and storing the url of images in an array. Now i have to show all that images on next View Controller using Tap Gestures and w开发者_如何转开发hen i click on images i have some action to perform. So please can anyone help me regarding that? I can provide the code what i have written if anyone want or tell me some tutorial as i am not able to get it from developer sites.


Load your images into UIImage objects like so:

UIImage *imageFromUrl = [UIImage imageWithContentsOfFile:[NSURL fileURLWithPath:url]];

Then, place them into UIImageView objects wherever you need them. The next thing you should do is add a TapGestureRecognizer:

UIImageView *imgView = [[UIImageView alloc] initWithImage:imageFromUrl];
UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(action)];
[imgView addGestureRecognizer:tgr];
[tgr release];
//Do the rest of your operations here, don't forget to release the UIImageView

And that's it. Do whatever you need in the "action" method that will get called on your ViewController


For that you have to use TapDetactingimgView. In that view you get scroll,single tap & double tap event.By that you can scroll image & able to tap on that image.

for that Visit : https://bitbucket.org/billgarrison/panzoomimagedemo/src/34671df61417/Classes/TapDetectingImageView.m

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号