⭐️⭐️⭐️⭐️⭐️⭐️⭐️ 有任何需要增加的功能,请直接邮箱联系我.欢迎点赞,谢谢 ⭐️⭐️⭐️⭐️⭐️⭐️⭐️
描述 | 状态 |
---|---|
UIViewController | √ |
适配屏幕旋转 | √ |
适配 iPhone5 ~iPhone12Pro_Max |
√ |
本地图片和网络图片 | √ |
本地视频和网络视频 | √ |
拖拽消失和拖拽取消 [API] | √ |
预加载图片 [API] | √ |
视频自动播放 [API] | √ |
视频倍速播放 [API] | √ |
视频支持 在线播放(不缓存,不下载) [API] | √ |
视频支持 先下载再播放(下次自动查找) [API] | √ |
自定义控件展示 [API] | √ |
自定义控件展示, 以及跟随浏览器动态显示 [API] | √ |
自定义数据源控件 [API] | √ |
所有操作都通过代理回调执行 [Delegate] | √ |
- 1.依赖
SDWebImage(5.0)
, 若需要本地gif图, 则依赖SDWebImage(5.8.3)
- 2.图片展示和视频播放已经可以使用
- 3.下载图片和下载适配至相册
- 4.自定义控件
- 5.自动管图片和视频已经实现
// 1.make every control as an object, put it into an array
KNPhotoItems *items = [[KNPhotoItems alloc] init];
items.url = @"http://xxxxxxxx/xxx.png";
items.sourceView = imageView;
// if current url is video type
// items.isVideo = true;
// if current image is locate gif
// itemM.isLocateGif = true;
[self.itemsArr addObject:items];
KNPhotoBrowser *photoBrowser = [[KNPhotoBrowser alloc] init];
photoBrowser.itemsArr = [self.itemsArr copy];
photoBrowser.currentIndex = tap.view.tag;
/// photoBrowser will present
[photoBrowser present];
/// photoBrowser will dismiss
/// [photoBrowser dismiss];
/// photoBrowser will dismiss with currentIndex
- (void)photoBrowser:(KNPhotoBrowser *)photoBrowser willDismissWithIndex:(NSInteger)index;
/// photoBrowser right top button did click with currentIndex (you can custom you right button, but if you custom your right button, that you need implementate your target action)
- (void)photoBrowser:(KNPhotoBrowser *)photoBrowser rightBtnOperationActionWithIndex:(NSInteger)index;
/// if it is network image, set `url` , do not set `sourceImage`
@property (nonatomic,copy ) NSString *url;
/// if it is locate image, set `sourceImage`, do not set `url`
@property (nonatomic,strong) UIImage *sourceImage;
/// sourceView is current control to show image or video.
/// 1. if the sourceView is kind of `UIImageView` or `UIButton` , just only only only set the `sourceView`.
/// 2. if the sourceView is the custom view , set the `sourceView`, but do not forget set `sourceLinkArr` && `sourceLinkProperyName`.
@property (nonatomic,strong) UIView *sourceView;
@property (nonatomic,strong) NSArray<NSString *> *sourceLinkArr;
/**
eg:
if the lastObject is kind of UIImageView , the `sourceLinkProperyName` is `image`
if the lastObject is kind of UIButton , the `sourceLinkProperyName` is `currentBackgroundImage` or `currentImage`
*/
/// the property'name of the sourceLinkArr lastObject
@property (nonatomic,copy ) NSString *sourceLinkProperyName;
pod 'KNPhotoBrowser'
// terminal : cd ~(current path)
pod install or pod update
- 1.目前适配 九宫格,scrollView,tableView, IM类型, 视频播放类型
- 2.如果bug, 希望大家给个issue,一起努力改好
- 3.完美适配
iPhone
iPad
- 4.完美适配
横竖屏
: 模仿微信和微博 - 5.有需要增加的功能, 请您通过邮箱或者QQ联系我!