I understand the need to load image asynchronously and i decided to make the life easier for developers by introducing the possibility to add your custom cell.
The following is a code example that i will introduce in the demo for the next release, but it's already usable with the current one.
Create your own cell by inheriting from AGPhotoBrowserCell or implementing the AGPhotoBrowserCellProtocol (in the latter, you will have to handle the layout code yourself). Since you are probably already using AFNetworking (or maybe not) or any other 3rd party library to fetch remote content you can reuse that library without modifying the photo browser. In this way your code will be resilient to future updates to my library and you can easily replace AFNetworking or the 3rd party library if you have to. Personally, i love to use SDWebImage:
In the AGPhotoBrowserDataSource class, implement
- (UITableViewCell<AGPhotoBrowserCellProtocol> *)cellForBrowser:(AGPhotoBrowserView *)browser withReuseIdentifier:(NSString *)reuseIdentifier to return MyPhotoBrowserCell.
The problem with the asynchronous load is that the browser messes up the view and returns wrong index for the photos. This results in displaying wrong images.
Thanks for the pull request @mikrobi but as i explained here https://github.com/andreagiavatto/AGPhotoBrowser/issues/6#issuecomment-24862409 the purpose of this component is to be easy to add/remove without forcing additional dependencies.
I understand the need to load image asynchronously and i decided to make the life easier for developers by introducing the possibility to add your custom cell.
The following is a code example that i will introduce in the demo for the next release, but it's already usable with the current one.
Create your own cell by inheriting from
AGPhotoBrowserCell
or implementing theAGPhotoBrowserCellProtocol
(in the latter, you will have to handle the layout code yourself). Since you are probably already using AFNetworking (or maybe not) or any other 3rd party library to fetch remote content you can reuse that library without modifying the photo browser. In this way your code will be resilient to future updates to my library and you can easily replace AFNetworking or the 3rd party library if you have to. Personally, i love to use SDWebImage:In the AGPhotoBrowserDataSource class, implement
- (UITableViewCell<AGPhotoBrowserCellProtocol> *)cellForBrowser:(AGPhotoBrowserView *)browser withReuseIdentifier:(NSString *)reuseIdentifier
to returnMyPhotoBrowserCell
.