Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想让文本在UILabel其放置的背景上呈现出负颜色。
UILabel
我将标签放在 Web 视图上,并且我希望该标签始终为背景的负色,这样无论哪种颜色(当 Web 视图滚动时)正好位于文本下方,它始终在负面的颜色。
谢谢你。
我不建议您这样做,因为 webView 的滚动部分不会因为其中的所有计算而变得平滑。因此,我建议您将背景 ImageView 设置为标签,并将带有负颜色的图像设置为该 ImageView 的字体颜色
另一种方法是将 设置shadowColor为相反的textColor(例如,分别为白色和黑色),以确保无论 Web 视图的背景颜色如何,您都始终能够挑选出文本。
shadowColor
textColor
不要忘记设置shadowOffset!
shadowOffset