原文http://www.reibang.com/p/210d70c5bcb9
github鏈接 https://github.com/mwaterfall/MWPhotoBrowser
1森书、 創(chuàng)建MWPhotoBrowser
//創(chuàng)建MWPhotoBrowser 劲藐,要使用initWithDelegate方法杖玲,要遵循MWPhotoBrowserDelegate協(xié)議
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
//設(shè)置當(dāng)前要顯示的圖片
[browser setCurrentPhotoIndex:indexPath.item];
//push到MWPhotoBrowser
[self.navigationController pushViewController:browser animated:YES];
2、實現(xiàn)代理
//返回圖片個數(shù)
- (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser{
return count;
}
//返回圖片模型
- (id <MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index{
//創(chuàng)建圖片模型
MWPhoto *photo = [MWPhoto photoWithURL:photoUrl];
return photo;
}