gpt4 book ai didi

iphone - 在禁用UIButton上

转载 作者:行者123 更新时间:2023-12-01 18:33:06 24 4
gpt4 key购买 nike

当禁用按钮。不透明度降低到50%。有没有办法将不透明度降低到25%

最佳答案

我将子类化UIButton并将setEnabled:方法重写为如下形式:

- (void) setEnabled:(BOOL)enabled {
NSLog(@"Button enabled = %d", enabled);
[super setEnabled:enabled];


UIColor *color = self.backgroundColor;
if (!self.isEnabled) {
self.backgroundColor = [color colorWithAlphaComponent:0.75];
} else {
self.backgroundColor = [color colorWithAlphaComponent:1.0];
}
}

关于iphone - 在禁用UIButton上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5910909/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com