Ali Ali - 5 months ago 28
iOS Question

UIButton title text color

I'm setting text color for

UIButton


headingButton.titleLabel.textColor = [UIColor colorWithRed:36/255.0
green:71/255.0
blue:113/255.0
alpha:1.0];


It's not changing color same code I'm using in another code it's working.

Answer

use

Objective-C

[headingButton setTitleColor:[UIColor colorWithRed:36/255.0 green:71/255.0 blue:113/255.0 alpha:1.0] forState:UIControlStateNormal];

Swift

headingButton.setTitleColor(UIColor.blackColor(), forState: .Normal)