Open j21medrano opened 4 years ago
Hello! I did an implementation to get around this problem, but I believe it is not one of the best.
func setupInfinityScroll () {
// ...
self.tableView.addInfiniteScroll { (tableView) in
self.changeColorActivityIndicator(at: tableView)
self.presenter!.requestNewDataExpandList()
}
}
func changeColorActivityIndicator(at tableView: UITableView) {
if #available(iOS 11.0, *) {
for item in tableView.subviews {
if let activityIndicator = item as? UIActivityIndicatorView {
activityIndicator.color = UIColor(named: "LoadingColor")
}
}
}
}
Where UIColor(named: "LoadingColor")
is an implementation for custom colors when dark mode is active. See about it in the link: https://developer.apple.com/documentation/xcode/supporting_dark_mode_in_your_interface
Bummer, in the meantime I suggest to set your own indicator view, i.e:
let indicator = UIActivityIndicatorView(style: .medium)
indicator.color = // my color
tableView.infiniteScrollIndicatorView = indicator
@Tiago-Amaral tableView.infiniteScrollIndicatorView
should be set at the time when addInfiniteScroll
is being called, so probably there is no need to traverse subviews to find the activity indicator. Thanks for posting the workaround!
Unable to see loading view on dark mode