Tim Bernikovich
Tim Bernikovich

Reputation: 5945

How to change UITableView's scroll indicator's color?

How to change UITableView's scroll indicator's color? I just need to set it's color. Don't propose change it's style to black or white.

Upvotes: 4

Views: 2365

Answers (1)

Wayne Hartman
Wayne Hartman

Reputation: 18477

There is not a public API for doing that. Any recommendation that would be given would be likely to be broken when Apple makes changes to the underlying structure of the scroll view.

That does not, however, preclude you from creating your own scroll indicator from scratch. I needed to do this in a particular use case where a scroll indicator needed to be visible at all times, not just when the user was touching the scroll view.

You can have your custom scroll indicator view and position it where it needs to be based upon the content offset of the scroll view and its scroll indicator insets. Adding a handler in scrollViewDidScroll: would then allow you to correctly position it and take advantage of any inertia that the scroll view has.

You can even contract the size of the scroll indicator view based on how far the user has scrolled beyond the content size of the scroll view, to give the same effect of bouncing that Apple's implementation has.

Upvotes: 4

Related Questions