框架大全和集合

SDPhotoBrowser查看照片

2017-02-07  本文已影响135人  张三儿

SDPhotoBrowser应用


#pragma mark- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath

{

SDPhotoBrowser *photoBrowser = [SDPhotoBrowser new];

photoBrowser.delegate = self;

photoBrowser.currentImageIndex = indexPath.item;

photoBrowser.imageCount = self.modelsArray.count;

photoBrowser.sourceImagesContainerView = self.collectionView;

[photoBrowser show];

}




- (NSURL *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index

{

WBPictureInfo *picInfo = self.pictureInfos[index];

//**拿到显示的图片的高清图片地址**

NSURL *url = [NSURL URLWithString:picInfo.bimiddleImage];

return url;

}



#pragma mark  SDPhotoBrowserDelegate

// 返回临时占位图片(即原来的小图)

- (UIImage *)photoBrowser:(SDPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index

{

// 不建议用此种方式获取小图,这里只是为了简单实现展示而已

SDCollectionViewDemoCell *cell = (SDCollectionViewDemoCell *)[self collectionView:self.collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForItem:index inSection:0]];

return cell.imageView.image;

}



上一篇下一篇

猜你喜欢

热点阅读