您的位置:首页 > 其它

MWPhotoBrowser的简单使用

2017-04-10 10:10 253 查看
原文http://www.jianshu.com/p/210d70c5bcb9
github链接 https://github.com/mwaterfall/MWPhotoBrowser

1、 创建MWPhotoBrowser

//创建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;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: