Easy-to-use rendering of a group of image frameworks (high imitation QQ/WeChat), a group of high imitation

Source: Internet
Author: User

Easy to use to present a group of pictures (high imitation QQ/), a group of high imitation

DEMO: http://www.code4app.com/thread-8612-1-1.html

 

Where can I use this framework?

  • It is mainly used for social apps to present a group of images.
  • The following are some of the popular social apps



Main PYPhotosView frameworks

[Objective-C] Check the source file copy code?
01020304050607080910111213141516171819202122232425 @interfacePYPhotosView : UIScrollView /** Network image album */@property(nonatomic, strong) NSArray*photos;/** Local album Image array */@property(nonatomic, strong) NSMutableArray*images;/** Status of all images */@property(nonatomic, assign) NSIntegerphotosState; /** Image spacing (5 by default )*/@property(nonatomic, assign) CGFloat photoMargin;/** The default image width/height (square) is 70 */@property(nonatomic, assign) CGFloat photoWH;/** Maximum number of lines (3 by default )*/@property(nonatomic, assign) NSIntegerphotosMaxCol; /** Quickly create a photosView object */+ (instancetype)photosView;/** Photos: array for saving image links */+ (instancetype)photosView:(NSArray*)photos; /** Automatically calculates the size of PYPhontosView based on the number of images and image status */- (CGSize)sizeWithPhotoCount:(NSInteger)count photosState:(NSInteger)state; @end



How to Use PYPhotosView

  • Manual import:
    • Upload all the files in the PYPhotosView folder to the project.
    • Import the master header file [Objective-C] to view the source file copy code?
      1 #import  "PYPhotosView.h"


Specific use (for details, see PYExampleViewController In the example Program)

  • Create an image link Array
  • Create a photosView object
  • Add object

Sample Code: [Objective-C] Check the source file copy code?
010203040506070809101112131415 // 1.1 create an image link ArrayNSMutableArray*imageUrls = [NSMutableArrayarray];   for(inti = 0; i < 6; i++) {      // 1.2 image Link      NSString*imageUrl = [NSStringstringWithFormat:@"https://github.com/iphone5solo/PYPhotosView/raw/master/images/IMG_02%02d.PNG", 25+i];      // 1.3 add an image Link      [imageUrls addObject:imageUrl];  }   // 2. Create a photosView  PYPhotosView *photosView = [PYPhotosView photosView:imageUrls];   // 3. Add a photosView  [self.view addSubview:photosView];







Custom photosView can be modified by setting the object property value of photosView.

  • Set the image spacing (5 by default)

// Set the image spacing to 10.
PhotosView. photoMargin = 10;

  • Set the image size (70*70 by default)

// Set the image width)
PhotosView. photoWidth = 100;
// Set the Image height)
PhotosView. photoHeight = 60;

  • Set the maximum number of images per line (3 by default)

// Set the maximum number of image Columns
PhotosView. photosMaxCol = 6;

Related Article

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.