美文网首页框架大全和集合
SDPhotoBrowser查看照片

SDPhotoBrowser查看照片

作者: 张三儿 | 来源:发表于2017-02-07 09:01 被阅读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;
    
    }
    
    
    
    

    相关文章

      网友评论

        本文标题:SDPhotoBrowser查看照片

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