TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jul 2017 |
Maintained by yangjun.
一款轻量级的图片浏览器,快速集成,简单易用(类似于UITableView的使用方法)可定制性强。
执行项目中的ExportFramework脚本自动生成framework
EZImageBrowser *browser = [[EZImageBrowser alloc] init];
[browser setDelegate:self];
[browser showFromView:cell currentIndex:indexPath.row completion:nil];
///cell的左右边距 default: 20
@property (nonatomic, assign) CGFloat cellMarginForLandscape;
/**
cneter default:x = center,y = to bottm 20 (EZImageBrowserPageTextPositionBottom)
fonr default: [UIFont systemFontOfSize:16]
text color: default:white
*/
@property (nonatomic, strong, readonly) UILabel *pageTextLabel;
//default: EZImageBrowserPageTextPositionBottom
@property (nonatomic, assign) EZImageBrowserPageTextPosition pageTextPosition;
/// default: NO
@property (nonatomic, assign) BOOL supportLongPress;
@protocol EZImageBrowserDelegate <NSObject>
@required
/**
每个cell的回调
@param imageBrowser 图片浏览器
@param index 当前cell索引
@return 返回cell,不能为nil,nil会crash
*/
- (EZImageBrowserCell *)imageBrowser:(EZImageBrowser *)imageBrowser cellForRowAtIndex:(NSInteger )index;
/**
cell总数的回调
@param imageBrowser 图片浏览器
@return cell总数
*/
- (NSInteger)numberOfCellsInImageBrowser:(EZImageBrowser *)imageBrowser;
@optional
/**
cell中图片默认大小的回调,不实现这个代理,会使用image的大小
@param imageBrowser 图片浏览器
@param index 当前cell索引
@return cell中图片大小
*/
- (CGSize)imageBrowser:(EZImageBrowser *)imageBrowser imageViewSizeForItemAtIndex:(NSInteger)index;
/**
显示cell后的回调
@param imageBrowser 图片浏览器
@param cell 当前cell
@param index 当前cell索引
*/
- (void)imageBrowser:(EZImageBrowser *)imageBrowser didDisplayingCell:(EZImageBrowserCell *)cell atIndex:(NSInteger)index;
/**
获取对应cell原空间的回调,dimmiss的时候可以动画返回对应位置
@param imageBrowser 图片浏览器
@param index 当前cell索引
@return 对应cell原控件
*/
- (nullable UIView *)imageBrowser:(EZImageBrowser *)imageBrowser fromViewForItemAtIndex:(NSInteger)index;
/**
获取page text的文本的回调,实现此代理可自定义
@param imageBrowser 图片浏览器
@param index 当前cell索引
@param count cell总数
@return page text 自定义文本
*/
- (NSString *)imageBrowser:(EZImageBrowser *)imageBrowser pageTextForItemAtIndex:(NSInteger)index count:(NSInteger)count;
/**
长按事件触发回掉,必须supportLongPress = YES来启动
@param imageBrowser 图片浏览器
@param index 当前cell索引
*/
- (void)imageBrowser:(EZImageBrowser *)imageBrowser didLongPressCellAtIndex:(NSInteger)index;
/**
单机事件触发,实现后默认dismiss不起作用
@param imageBrowser 图片浏览器
@param index 当前cell索引
*/
- (void)imageBrowser:(EZImageBrowser *)imageBrowser didClickCellAtIndex:(NSInteger)index;
/**
双击事件触发,实现后默认双击放大不起作用
@param imageBrowser 图片浏览器
@param index 当前cell索引
*/
- (void)imageBrowser:(EZImageBrowser *)imageBrowser didDoubleClickCellAtIndex:(NSInteger)index;
/**
图片浏览器将显示的回调
@param imageBrowser 图片浏览器
*/
- (void)imageBrowserWillAppear:(EZImageBrowser *)imageBrowser;
/**
图片浏览器已显示的回调
@param imageBrowser 图片浏览器
*/
- (void)imageBrowserDidAppear:(EZImageBrowser *)imageBrowser;
/**
图片浏览器将消失的回调
@param imageBrowser 图片浏览器
*/
- (void)imageBrowserWillDisappear:(EZImageBrowser *)imageBrowser;
/**
图片浏览器已消失的回调
@param imageBrowser 图片浏览器
*/
- (void)imageBrowserDidDisappear:(EZImageBrowser *)imageBrowser;
@end
- (EZImageBrowserCell *)imageBrowser:(EZImageBrowser *)imageBrowser cellForRowAtIndex:(NSInteger )index{
EZImageBrowserCell *cell = [imageBrowser dequeueReusableCell];
if (!cell) {
cell = [[EZImageBrowserCell alloc] init];
}
cell.imageView.image = [UIImage imageNamed:self.imageUrlStringArray[index]];
return cell;
}
EZImageBrowserKit遵守MIT协议,具体请参考MIT