Quick integration with picture browser quick Integration Picture Browser->mjphotobrowser use

Source: Internet
Author: User

Introduced:

A more complete picture browser, high imitation of Sina Weibo image browsing effect, features include: Download browse the Internet pictures, click Thumbnails full screen display pictures, when loading a larger picture will appear a circular progress bar, swipe to browse all the pictures, save the pictures to the local album, GIF picture playback and so on. And just a few lines of code to add the image browser function.

Project Address: http://code4app.com/ios/Quick Integration Picture Browser/525e06116803fa7b0a000001

Use:

                 for(inti =0; i<3; i++) {Uiimageview*img =[[Uiimageview alloc]init]; Img.tag=i; //Click the Add gestureUITapGestureRecognizer *singletapgesturerecognizer =[[UITapGestureRecognizer alloc]initwithtarget:self Action: @selector (Tapphoto:)]; [Singletapgesturerecognizer setnumberoftapsrequired:1]; [img Addgesturerecognizer:singletapgesturerecognizer];//This is a very important line. ImageView cannot be interacted by defaultimg.userinteractionenabled =YES;            [img Setcontentmode:uiviewcontentmodescaleaspectfill]; Img.clipstobounds=YES;                        [Cdutils Displayiconimagewithurl:model.photos[i] imageview:img]; Img.frame= CGRectMake ((([UIScreen mainscreen].bounds.size.width-2)/3+1) *i,0, ([UIScreen mainscreen].bounds.size.width-2)/3, ([UIScreen mainscreen].bounds.size.width-2)/3);        [Self.imagepicview addsubview:img]; }
/** * Monitor the image click*/- (void) Tapphoto: (UITapGestureRecognizer *) recognizer{//1. Create a picture browserMjphotobrowser *brower =[[Mjphotobrowser alloc] init]; //2. Tell the picture browser to show all picturesNsmutablearray *photos =[Nsmutablearray array];  for(inti =0; i < Self.picAry.count; i++) {        //passing data to the browserMjphoto *photo =[[Mjphoto alloc] init]; Photo.url=[Nsurl Urlwithstring:self.picary[i]]; NSLog (@"%@", Photo.url); Photo.srcimageview= (Uiimageview *) Recognizer.view;//set the source of which one uiimageview[photos Addobject:photo]; } Brower.photos=photos; //3. Set the default display of the picture indexBrower.currentphotoindex =Recognizer.view.tag; //4. Display browser[Brower show];}

To include these two header files:

#import "MJPhoto.h"

#import "MJPhotoBrowser.h"

Quick integration with picture browser quick Integration Picture Browser->mjphotobrowser use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.