Disabled UIButton not faded or grey

后端 未结 19 1589
死守一世寂寞
死守一世寂寞 2020-12-04 16:11

In my iPhone app, I have a UIButton which I have created in Interface Builder. I can successfully enable and disable it like this in my code ...

sendButton.e         


        
19条回答
  •  死守一世寂寞
    2020-12-04 16:38

    #import "UIButton+My.h"
    #import 
    @implementation UIButton (My)
    
    
    -(void)fade :(BOOL)enable{
        self.enabled=enable;//
        self.alpha=enable?1.0:0.5;
    }
    
    @end
    

    .h:

    #import 
    @interface UIButton (My)
    
    -(void)fade :(BOOL)enable;
    
    @end
    

提交回复
热议问题