标签:
DEMO下载地址:http://www.code4app.com/thread-8612-1-1.html
什么地方用到这个框架
PYPhotosView框架的主要类PYPhotosView
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
@interface
PYPhotosView : UIScrollView/**
网络图片相册 */@property
(nonatomic,
strong) NSArray
*photos;/**
本地相册图片数组 */@property
(nonatomic,
strong) NSMutableArray
*images;/**
所有图片的状态 */@property
(nonatomic,
assign) NSInteger
photosState;/**
图片间距(默认为5) */@property
(nonatomic,
assign) CGFloat photoMargin;/**
图片的宽高(正方形)默认为70 */@property
(nonatomic,
assign) CGFloat photoWH;/**
每行最多个数(默认为3) */@property
(nonatomic,
assign) NSInteger
photosMaxCol;/**
快速创建photosView对象 */+
(instancetype)photosView;/**
photos: 保存图片链接的数组 */+
(instancetype)photosView:(NSArray
*)photos;/**
根据图片个数和图片状态自动计算出PYPhontosView的size */-
(CGSize)sizeWithPhotoCount:(NSInteger)count
photosState:(NSInteger)state;@end |
如何使用PYPhotosView
|
1
|
#import
"PYPhotosView.h" |
具体使用(详情见示例程序中的PYExampleViewController)
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
|
//
1.1 创建图片链接数组NSMutableArray
*imageUrls = [NSMutableArray
array]; for
(int
i = 0; i < 6; i++) { //
1.2 图片链接 NSString
*imageUrl = [NSString
stringWithFormat:@"https://github.com/iphone5solo/PYPhotosView/raw/master/images/IMG_02%02d.PNG",
25+i]; //
1.3 添加图片链接 [imageUrls
addObject:imageUrl]; } //
2. 创建一个photosView PYPhotosView
*photosView = [PYPhotosView photosView:imageUrls]; //
3. 添加photosView [self.view
addSubview:photosView]; |
自定义photosView通过设置photosView的对象属性值即可修改
// 设置图片间距为10
photosView.photoMargin = 10;
// 设置图片的宽(width)
photosView.photoWidth = 100;
// 设置图片的高(height)
photosView.photoHeight = 60;
// 设置图片最多列数
photosView.photosMaxCol = 6;
标签:
原文地址:http://www.cnblogs.com/Code4/p/5614997.html