1. 程式人生 > >ios UIButton 文字透明度設定

ios UIButton 文字透明度設定

[self.navBar.rightButton2 setTitleColor:TFCOLOR_0093FF forState:UIControlStateNormal];
    [self.navBar.rightButton2 setTitleColor:[UIColor colorWithRed:0 green:(9.0*16+3.0)/255.0 blue:1.0 alpha:0.5] forState:UIControlStateDisabled];


- (void)setRightButtonEnable:(BOOL)a{
    if (a) {
        self.navBar.rightButton2.enabled = a;
    } else{
         self.navBar.rightButton2.enabled = a;
    }
}

設定UIButton的enable屬性後,設定文字的透明度。