ESPictureBrowser - 仿即刻App風格的圖片瀏覽效果
ESPictureBrowser
類似于<即刻>應用的圖片瀏覽器效果
-
支持 iOS 8 及以上
效果圖
集成方式
-
cocoapod
pod 'ESPictureBrowser', '~> 0.2.1'
使用方式
- 初始化并顯示
/** 顯示圖片瀏覽器@param fromView 用戶點擊的視圖 @param picturesCount 圖片的張數 @param currentPictureIndex 當前用戶點擊的圖片索引 */
(void)showFormView:(UIView *)fromView picturesCount:(NSUInteger)picturesCount currentPictureIndex:(NSUInteger)currentPictureIndex</pre>
-
實現代理方法
/** 獲取對應索引的圖片大小
@param pictureBrowser 圖片瀏覽器 @param index 索引
@return 圖片大小 */
-
- (CGSize)pictureView:(ESPictureBrowser *)pictureBrowser imageSizeForIndex:(NSInteger)index { ... }
/** 獲取對應索引默認圖片,可以是占位圖片,可以是縮略圖
@param pictureBrowser 圖片瀏覽器 @param index 索引
@return 圖片 */
- (UIImage )pictureView:(ESPictureBrowser )pictureBrowser defaultImageForIndex:(NSInteger)index { ... }
/** 獲取對應索引的高質量圖片地址字符串
@param pictureBrowser 圖片瀏覽器 @param index 索引
@return 圖片的 url 字符串 */
- (NSString )pictureView:(ESPictureBrowser )pictureBrowser highQualityUrlStringForIndex:(NSInteger)index {
...
}</pre>
-
其他配置
/* 圖片之間的間距,默認: 20/ @property (nonatomic, assign) CGFloat betweenImagesSpacing;
-
/* 頁數文字中心點,默認:居中,中心 y 距離底部 20 / @property (nonatomic, assign) CGPoint pageTextCenter;
/* 頁數文字字體,默認:系統字體,16號 / @property (nonatomic, strong) UIFont *pageTextFont;
/* 頁數文字顏色,默認:白色 / @property (nonatomic, strong) UIColor *pageTextColor;
/* 長按圖片要執行的事件,將長按的索引回調 / @property (nonatomic, copy) void(^longPressBlock)(NSUInteger);</pre>
其他
不存在<即刻 v2.7.0>中的圖片放大之后,拖動消失的 Bug,具體 bug 見效果圖:
TODO
-
加載圖片進度效果
License
MIT