【发布时间】:2011-11-24 11:17:33
【问题描述】:
我有一个带有图像的 UIButton,在它的禁用状态下,这个图像应该有 .3 alpha。
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *arrowImage = [UIImage imageNamed:@"arrow.png"];
[button setImage:arrowImage forState:UIControlStateNormal];
// The arrow should be half transparent here
[button setImage:arrowImage forState:UIControlStateDisabled];
我该如何做到这一点?
更新:我注意到,默认情况下 UIButton 在禁用状态下会降低图像的 alpha(可能为 0.5?)。但我想知道如何微调这个值。
【问题讨论】:
-
您最终找到解决方案了吗?
-
我也有兴趣为这个问题找到解决方案。
-
我想这个问题的答案已经添加到这里了。 stackoverflow.com/questions/3467119/…
标签: ios iphone objective-c uibutton uiimage