colorWithAlphaComponent
UIColor *color = [UIColor redColor];
[color colorWithAlphaComponent:0.5f];
当设置完红色后,调用此方法设置颜色透明度,为啥不起作用;
它是返回新的包含透明度的颜色, 而不是设置color的颜色。
这样用:
UIColor *color = [UIColor redColor];
UIColor *cl = [color colorWithAlphaComponent:0.5f];
color没有透明度,cl有透明度。
不知道你明白没。看文档
Creates and returns a color object that has the same color space and component values as the receiver, but has the specified alpha component.
posted on 2012-04-19 08:30 pengyingh 阅读(3908) 评论(0) 编辑 收藏 举报