类似iOS自带相册应用的图片浏览的实现

MWPhotoBrowser是一个类似iOS自带的相册应用的实现,可显示来自手机的图片或者是网络图片,可自动从网络下载图片并进行缓存,可对图片进行缩放等操作。

 

主要是实现MWPhotoBrowserDelegate中的几个方法即可。

 

#pragma mark - MWPhotoBrowserDelegate

- (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser {
    return _photos.count;
}

- (MWPhoto *)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index {
    if (index < _photos.count)
        return [_photos objectAtIndex:index];
    return nil;
}

- (MWCaptionView *)photoBrowser:(MWPhotoBrowser *)photoBrowser captionViewForPhotoAtIndex:(NSUInteger)index {
    MWPhoto *photo = [self.photos objectAtIndex:index];
    MWCaptionView *captionView = [[MWCaptionView alloc] initWithPhoto:photo];
    return [captionView autorelease];
}

 

具体的实现请参考附件。

类似iOS自带相册应用的图片浏览的实现_第1张图片

你可能感兴趣的:(ios,iPhone,图片浏览)