我用小alpha做了一个视图,在这个视图中我得到了文本标签,文本是灰色的,我不会在我的视图中更改alpha。如何让文字更亮?
答案 0 :(得分:1)
我认为你的意思是视图应该是半透明的,但文字不应该。
您可以通过设置半透明背景颜色来实现:
UIColor *semitrasparentRedColor = [[UIColor redColor] colorWithAlphaComponent:0.3f];
UIView *myViewWithSemitransparentBackground = [[UIView alloc] initWithFrame:myFrame];
myViewWithSemitransparentBackground.backgroundColor = semitrasparentRedColor;
[myViewWithSemitransparentBackground addSubview:myLabel];