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

Added indicatorColor property to customize UIActivityIndicator color #212

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vikram1008
Copy link

This PR adds the ability to customize the color of the loading indicators used in both the pull-to-refresh and infinite scrolling components of UITableView. A new property, indicatorColor, has been introduced to allow developers to set custom colors for the activity indicators in both the header and footer. This is particularly useful for ensuring that the loading indicators match the app's overall theme.

Changes:
Added the indicatorColor property to the pull-to-refresh and infinite scrolling animators.
Enabled color customization for the loading indicators in both the pull-to-refresh header and infinite scrolling footer.

Why This Is Needed:
This update enhances the flexibility of the pull-to-refresh and infinite scrolling components by allowing developers to match the loading indicator's color to the app's design, making it easier to integrate the indicators into both light and dark mode UIs.

How to Use:
To customize the color of the loading indicators, simply set the indicatorColor property on the header or footer animator as shown below:

// For pull-to-refresh header
let header = ESRefreshHeaderAnimator(frame: CGRect.zero)
header.indicatorColor = UIColor.red // Set the header indicator color
self.tableView.es.addPullToRefresh(animator: header) { [weak self] in
    self?.refresh()  // Trigger the refresh action
}

// For infinite scrolling footer
let footer = ESRefreshFooterAnimator(frame: CGRect.zero)
footer.indicatorColor = UIColor.green // Set the footer indicator color
self.tableView.es.addInfiniteScrolling(animator: footer) { [weak self] in
    self?.loadMore()  // Trigger the load more action
}

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

Successfully merging this pull request may close these issues.

1 participant