你可以在它的一个子视图上重写父UIView的alpha值吗? [英] Can you override a parent UIView's alpha value on one of its subviews?

查看:270
本文介绍了你可以在它的一个子视图上重写父UIView的alpha值吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有些透明的视图(alpha = 0.6)有一些子视图。我想要一个子视图(UILabel)使用alpha的1.0绘制,因为混合使文本难以阅读,但通过将其添加为主视图的子视图,它已采用其父的alpha值。有没有办法重写这种行为?我相信我必须从子视图中删除它,但想问,看看是否可能缺少一些东西。

I have a somewhat transparent view (alpha = 0.6) that has some subviews. I'd like one of the subviews (a UILabel) to be drawn with alpha of 1.0 because the blending makes the text difficult to read but by adding it as a subview of the main view it has adopted its parent's alpha value. Is there a way to override this behavior? I believe I'll have to remove it from the subview but wanted to ask and see if maybe I'm missing something.

推荐答案

你是正确的。您必须将UILabel从透明视图中移出,以使其呈现为不透明。

You are correct. You'll have to move the UILabel out of the transparent view to get it to render as non-transparent.

这篇关于你可以在它的一个子视图上重写父UIView的alpha值吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆