This seems to have changed in iOS 11, at least in my case when I use the UIAppearance protocol. Not sure if this is a mistake or intentional.
I also found that I couldn’t hide the values together (for example .normal|.disabled), since that meant that it would only apply the font if the control satisfies all the states.
So I finished this:
for controlState in [UIControlState.normal, UIControlState.disabled, UIControlState.focused, UIControlState.highlighted, UIControlState.selected] {
barButton.setTitleTextAttributes([NSFontAttributeName: customFontName], for: controlState)
}
To update it everywhere using the UIAppearance protocol:
for controlState in [UIControlState.normal, UIControlState.disabled, UIControlState.focused, UIControlState.highlighted, UIControlState.selected] {
UIBarButtonItem.appearance().setTitleTextAttributes([NSFontAttributeName: customFontName, for: controlState);
}
Seanr source
share