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 |
@interface PYPhotosView : 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) NSInteger photosState; /** 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) NSInteger photosMaxCol; /** 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 Array NSMutableArray *imageUrls = [ NSMutableArray array]; for ( int i = 0; i < 6; i++) { // 1.2 image Link NSString *imageUrl = [ NSString stringWithFormat: @"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;