I am working on an application where I call the UITextFieldDelegate method:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { }
I successfully call it, and inside the method I enable a specific button. This also works great. However, the problem I am facing is that I cannot make the title on the button bold when the button is on. I set the font in Interface Builder and I'm trying to make a bold title programmatically. Here is the relevant code that shows what I'm doing:
if ([keys count] == [_tireName count]) { [_doneButton setEnabled:YES];//this line works [[_doneButton titleLabel] setFont:[UIFont boldSystemFontOfSize:28]];//this line does nothing } else if ([keys count] < [_tireName count]){ [_doneButton setEnabled:NO];//this line works [[_doneButton titleLabel] setFont:[UIFont systemFontOfSize:28]];//this line does nothing }
Ignore the if clause. I want the text on the button to be bold when the button is on, and I want the text on the button to be βnormalβ when it is off. Can anyone understand what I'm doing wrong?
Thanks in advance to everyone who responds.
source share