Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dark Mode #81

Open
j21medrano opened this issue Nov 5, 2019 · 2 comments
Open

Dark Mode #81

j21medrano opened this issue Nov 5, 2019 · 2 comments

Comments

@j21medrano
Copy link

Unable to see loading view on dark mode

@ghost
Copy link

ghost commented Feb 26, 2020

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

@pronebird
Copy link
Owner

pronebird commented Feb 14, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants