alpha

UIView alpha vs. UIColor alpha

梦想的初衷 提交于 2019-12-04 16:20:18
问题 I would like to know the difference between: Assigning my UIView a color with <1 alpha vs Assigning it a non-transparent color but giving the UIView a <1 alpha value. On the screenshot I have made two UIViews with two black (alpha = 1.0) UILabels on top of each: Assume a macro _RGB is defined before: #define _RGB(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a] and then here is the code:: [_view1 setBackgroundColor:_RGB(255, 0, 0, 1)]; [_view1 setAlpha:0.5]; [_view2