美文网首页
MWPhotoBrowser的简单使用

MWPhotoBrowser的简单使用

作者: 码农小白 | 来源:发表于2017-03-06 09:49 被阅读97次

原文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;

}

相关文章

网友评论

      本文标题:MWPhotoBrowser的简单使用

      本文链接:https://www.haomeiwen.com/subject/kepygttx.html