MWPhotoBrowser的简单使用

xiaoxiao2021-02-28  131

MWPhotoBrowser的简单使用

最近做的项目有类似朋友圈动态的功能,其中需求点击图片可以浏览。然后就用了下MWPhotoBrowser这个第三方图片浏览器,感觉很不错。

MWPhotoBrowser 的github链接 https://github.com/mwaterfall/MWPhotoBrowser


1、 创建MWPhotoBrowser

要使用initWithDelegate方法,要遵循MWPhotoBrowserDelegate协议

//创建MWPhotoBrowser ,要使用initWithDelegate方法,要遵循MWPhotoBrowserDelegate协议 MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self]; //设置当前要显示的图片 [browser setCurrentPhotoIndex:indexPath.item]; //push到MWPhotoBrowser [self.navigationController pushViewController:browser animated:YES];

2、实现代理

//返回图片个数 - (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser{ return count; } //返回图片模型 - (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index{ //创建图片模型 MWPhoto *photo = [MWPhoto photoWithURL:photoUrl]; return photo; }

大功告成恭喜你已经集成了一个很好用的图片浏览器啦。 其实 MWPhotoBrowser还有其他很多很好用的功能。

例如:

播放视频已九宫格的方式显示图片阵列分享图片选择器

如果需要这些功能直接到 [MWPhotoBrowser]的gith地址看吧 https://github.com/mwaterfall/MWPhotoBrowser。不过纯英文,会有点儿压力。

下面有个复杂一些的应用的介绍文章:

MWPhotoBrowser框架的使用步骤

http://blog.csdn.net/u012592258/article/details/50836138

转载请注明原文地址: https://www.6miu.com/read-36298.html

最新回复(0)