2

Is it possible to invert the color of a UIView or UIScrollView and all its subviews in iOS?

If so how can I accomplish this?

user906357
  • 4,575
  • 7
  • 28
  • 38
  • Isn't this basically a repeat of [your previous question](http://stackoverflow.com/questions/24835874/inverting-the-colors-of-a-uiscrollview)? – rmaddy Jul 19 '14 at 15:24

1 Answers1

-1

First, you need to create an inverted color of current background color of UIView. You can learn more about how to accomplish it on this StackOverflow question — How to get inverse color from UIColor?

Then, you need to iterate over all UIView subviews and apply inverted color as a background.

view.backgroundColor = invertedColor;
for (UIView *subview in view.subviews) {
    subview.backgroundColor = invertedColor;
}
Community
  • 1
  • 1
Rinat Khanov
  • 1,566
  • 10
  • 32