I have a UILabel
that is placed on top of a UIImageView
. The UIImageView
can change displaying a variety of images. Depending on the image displayed in the UIImageView
, the UILabel
's text color must be able to change dynamically. For instance, when a light colored image is displayed, a dark UILabel
text color will be used, or when a dark image is used, a light text color will be used.
In Swift, what is the best, simple, most efficient method to extract the RGB value of a single pixel or average RGB value of a group of pixels directly behind the position of UILabel
that is sitting above a UIImage
?
Or even better, in Swift, is there a UILabel
method that changes the text colour dynamically based on the background it is positioned above?
Thank you.