How do you change UIButton image alpha on disabled state?

后端 未结 11 2198
庸人自扰
庸人自扰 2021-02-03 23:22

I have a UIButton with an image and on its disabled state, this image should have .3 alpha.

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
UIIm         


        
11条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-04 00:23

    If setting alpha while the button is disabled doesn't work, then just make your disabled image at the alpha value you desire.

    Just tested this, you can set the alpha on the UIButton, regardless of state and it works just fine.

    self.yourButton.alpha = 0.25;
    

提交回复
热议问题