3

enter image description here

Because the UIImageView in the background is very light, you can't see the text in the foreground on top of the UIVisualEffectView. I want to detect whether the background is light or not and if so, change the text colour to something darker. How can I do this?

4

1 回答 1

2

要检测 UIView 的主色,需要两个步骤。首先是捕获视图的图像数据,如下所述:How to capture UIView to UIImage without loss of quality on Retina display

其次是确定视图的主要颜色是什么,如下所述: 在 iTunes 11 中为歌曲列表着色的算法如何工作?

然后根据结果进行调整。

就个人而言,我会简单地使用深色文本颜色来进行光模糊。或者继续使用浅色文本并使用深色模糊效果。或者在导航栏上设置色调颜色。

于 2015-02-11T21:25:27.167 回答