So I have a class which calls an API method and once the request is finished, it calls a delegate method on my controller view, where I do:
[self.myButton setEnabled:NO];
self.myButton.titleLabel.textColor = [UIColor grayColor];
NSLog(@"%@", self.myButton.titleLabel.textColor);
To change the text color from blue to gray to let a user know he/she cannot click the button second time.
But, the color doesn’t change. This is what’s in the debug log:
UIDeviceWhiteColorSpace 0.5 1
Why? When I do the same in the:
- (void)viewWillAppear:(BOOL)animated
It works and changes the color of the text on the button to gray.
you can do this in you viewDidLoad
When you will do the setEnabled:NO, it will automatically switch to the disable state and so the text color will be set to gray.