Closed kiwo12345 closed 9 years ago
You can configure MVCarouselCollectionView to use an image loader of your choice (see MVCarouselCollectionView.commonImageLoader). A couple of different image loaders are already provided. Example:
var imageViewLoadCached : ((imageView: UIImageView, imagePath : String, completion: (newImage: Bool) -> ()) -> ()) = {
(imageView: UIImageView, imagePath : String, completion: (newImage: Bool) -> ()) in
imageView.image = UIImage(named:imagePath)
completion(newImage: imageView.image != nil)
}
var imageViewLoadFromPath: ((imageView: UIImageView, imagePath : String, completion: (newImage: Bool) -> ()) -> ()) = {
(imageView: UIImageView, imagePath : String, completion: (newImage: Bool) -> ()) in
var url = NSURL(string: imagePath)
imageView.sd_setImageWithURL(url, completed: {
(image : UIImage?, error: NSError?, cacheType: SDImageCacheType, imageURL: NSURL?) in
completion(newImage: image != nil)
})
}
Thanks for sharing this. But how do I switch between synchronous or asynchronous remote/local ?
Thanks in advance