IOS Image browser Sdphotobrowser like a friend's circle

Source: Internet
Author: User

Sdphotobrowser. Demo

1, in the file sdbrowserimageview.m useful sdwebimage to the network load the picture needed to remove the comments can be

#import "ViewController.h"#import "SDPhotoBrowser.h"@interfaceViewcontroller () <SDPhotoBrowserDelegate>{Nsmutablearray*arrayimage;}@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload];        [Self creatui]; }-(void) creatui{Arrayimage= [NsmutablearrayNew];  for(inti =0; i<9; i++) {Uiimageview* Imavi = [[Uiimageview alloc] Initwithframe:cgrectmake (i%3* -+ -, i/3* -+ -, the, the)]; Imavi.tag=i; Imavi.userinteractionenabled=YES; UITapGestureRecognizer* Tap =[[UITapGestureRecognizer alloc]init];                [Tap addtarget:self Action: @selector (tapaction:)];        [Imavi Addgesturerecognizer:tap]; Imavi.image= [UIImage imagenamed:[nsstring stringWithFormat:@"%d.jpg". II1]];                [Self.view Addsubview:imavi]; [Arrayimage addobject:[nsstring stringWithFormat:@"%d.jpg". II1]]; }        }-(void) Tapaction: (uitapgesturerecognizer*) tap{UIView* VI =Tap.view; Sdphotobrowser* Broser =[[Sdphotobrowser alloc] init]; Broser.currentimageindex=Vi.tag; Broser.sourceimagescontainerview=Self.view; Broser.imagecount=Arrayimage.count; Broser.Delegate=Self ;            [Broser show]; }////////////////////////////////////////////delegate//////////////////Iamge of the website//-(nsurl*) Photobrowser: (Sdphotobrowser *) browser Highqualityimageurlforindex: (nsinteger) index{//////nsstring *imagename = Arrayimage[index];//Nsurl *url = [[NSBundle mainbundle] Urlforresource:imagename Withextension:nil];//return URL;//}//The local image-(uiimage*) Photobrowser: (Sdphotobrowser *) Browser Placeholderimageforindex: (nsinteger) index{UIImage* ImageView =[UIImage Imagenamed:arrayimage[index]]; returnImageView;}

IOS Image browser Sdphotobrowser like a friend's circle

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.