我創建了一個視圖,並設置兩個屬性,backgroundColor
和backgroundAlpha
,當我設置v.background = color
的的backgroundColor是藍色的,但是當我設置v.background = [color colorWithAlphaComponent:b]
的的backgroundColor是明確的,因爲如果B是零;我的自定義視圖唐不顯示的backgroundColor
+ (instancetype)initWithBgrColor:(UIColor *)color bgrAlpha:(NSInteger) b
{
view *v = [[view alloc] init];
v.backgroundColor = [color colorWithAlphaComponent:b];
return v;
}
什麼是你逝去的B點的價值? – tausun
更改b值並檢查一次 –