简体   繁体   中英

how to change the Label/TextField text color Based on background image color in iOS Objective-C?

I'm working on UIImageView with Labels and TextFields. In my scenario, how can I change the label text color based on background image?

For Example : My Background image white, in that scenario the label text color is black or red except white.

Please help me. Thanks in Advance.

Just engineering of answers found online:

  1. Calculate average color for your background image: how to find average color of image

  2. Calculate an inverted color for the found color: inverting a UIColor

  3. Set label.textColor to a result color

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM