Reputation: 791
so, i'm using swift library ImageSlideshow and use KingfisherSource to set image. I get the url image from Alamofire request
How to make loading/activity indicator before image showed?
Here's my code:
var arrayImage = [InputSource]()
for data in items{
let Menu = ModelBanner()
Menu.id = (data["id"].intValue)
Menu.banner = (data["banner"].stringValue)
self.listBanner.append(Menu)
self.arrayImage.append(KingfisherSource(urlString: data["banner"].stringValue)!)
}
self.slideImage.contentScaleMode = .scaleAspectFill
self.slideImage.setImageInputs(self.arrayImage)
Upvotes: 1
Views: 1577
Reputation: 19156
Better way to show activity indicator is to use the default implementation.
slideshow.activityIndicator = DefaultActivityIndicator()
You can customize style and color of the indicator:
slideshow.activityIndicator = DefaultActivityIndicator(style: .white, color: nil)
There's also an option to use your own activity indicator. You just need to implement ActivityIndicatorView
and ActivityIndicatorFactory
protocols.
For more details see the Activity Indicator section here.
Upvotes: 0
Reputation: 2513
activityIndicator.hidesWhenStopped = true
activityIndicator.startAnimating()
activityIndicator.stopAnimating()
Above code assumes activityIndicator
is the outlet connection name of the UIActivityIndicatorView
Upvotes: 1