项目
在 GitHub 查看
LuKane/KNPhotoBrowser
关于
图片浏览器(本地和网络) ,视频浏览器 (本地和网络), 无耦合性,自定义控件,资源路径保存和获取, 完美适配 iPhone 以及 iPad ,屏幕旋转功能.
设计与媒体实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README_Chinese.md
原文
KNPhotoBrowser
微信 && 微博 图片||视频 浏览器
⭐️⭐️⭐️⭐️⭐️⭐️⭐️ 有任何需要增加的功能,请直接邮箱联系我.欢迎点赞,谢谢 ⭐️⭐️⭐️⭐️⭐️⭐️⭐️





内容
| 描述 |
|---|
| UIViewController |
| 适配屏幕旋转, iPad分屏 |
适配 iPhone5~iPhone14Pro_Max |
| 本地图片和网络图片 |
| 本地视频和网络视频 |
| 底部页签是否可以修改值, 切换顶部视图 [API] |
| 拖拽消失和拖拽取消(普通图片,长图,视频) [API] |
| 预加载图片 [API] |
| 视频自动播放 [API] |
| 视频倍速播放 [API] |
| 视频支持 在线播放(不缓存,不下载) [API] |
| 视频支持 先下载再播放(下次自动查找) [API] |
| 自定义控件展示 [API] |
| 自定义控件展示, 以及跟随浏览器动态显示 [API] |
| 自定义数据源控件 [API] |
| 所有操作都通过代理回调执行 [Delegate] |
| 新增push ViewController的模式 (2022-12) [API] |
| 新增主动刷新数据源方法 (2022-12) [API] |
一.功能描述及要点
- 1.依赖
>=SDWebImage(5.0), 若需要本地gif图, 则依赖>=SDWebImage(5.8.3) - 2.图片展示和视频播放已经可以使用
- 3.下载图片和下载适配至相册
- 4.自定义控件
- 5.自动管图片和视频已经实现
二.方法调用
(1).初始化相应的参数
// 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];
(2).创建KNPhotoBrowser
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];
(3).提供代理方法 --> KNPhotoBrowserDelegate
浏览器消失
/// 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;
4.组件: KNPhotoItems
items 的基本参数
/// 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;
自定义数据源view
@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;
3.如何安装
pod 'KNPhotoBrowser'
// terminal : cd ~(current path)
pod install or pod update
补充
- 1.目前适配 九宫格,scrollView,tableView, IM类型, 视频播放类型
- 2.如果bug, 希望大家给个issue,一起努力改好
- 3.完美适配
iPhoneiPad - 4.完美适配
横竖屏: 模仿微信和微博 - 5.有需要增加的功能, 请您通过邮箱或者QQ联系我!
探索相关项目
加载中…