I am Using AlamofireImage library and i want to add a subview
(UIActivityIndicator) on ImageView until image did not download. but have no idea how to do it.
self.imgView_main.af_setImageWithURL(downloadURL)
image is downloading. but how to show UIActivityIndicator
please help me
You can use completion:
function for that, First start the activityIndicator
and stop the indicator when you get the image in completion
block like this.
self.activityIndicator.startAnimating()
self.listImageView.af_setImageWithURL(
NSURL(string: list!.image!)!,
placeholderImage: nil,
filter: nil,
imageTransition: .CrossDissolve(0.5),
completion: { response in
let image = response.result.value // UIImage Object
self.activityIndicator.stopAnimating()
}
)