-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting UIButton.title font #4
Comments
daniel-hall
pushed a commit
that referenced
this issue
Sep 18, 2016
- Add styleable titleFont property to buttons - Fix for iOS 10 issue where styling was occuring before layout and thus applying some wrong calculations
daniel-hall
pushed a commit
that referenced
this issue
Sep 18, 2016
- Added styleable titleFont property to buttons - Fix for iOS 10 issue where styling was occuring before layout and thus applying some wrong calculations
Hi @adamn , Thanks for opening an issue for this and my apologies for not seeing it until today. I added "titleFont" as styleable UIButton property in pull request #6 and it's now in the master branch. To use it, just reference it inside a button style class, something like this: struct MyButtonStyle : StyleClass {
var stylePropertySets = StylePropertySetCollection()
init() {
UIButton.titleColorForNormalState = UIColor(red:0.21, green:0.29, blue:0.36, alpha:1.0)
UIButton.titleColorForHighlightedState = UIColor(red:0.18, green:0.24, blue:0.31, alpha:1.0)
UIButton.titleColorForDisabledState = UIColor(red:0.18, green:0.24, blue:0.31, alpha:1.0)
UIButton.titleFont = UIFont(name: "Papyrus", size: 14.0) // <--- Here is where it's used
UIView.backgroundColor = UIColor(white: 0.82, alpha: 1.0)
}
} Now, when you assign the style "MyButtonStyle" to a button in a storyboard it will use the font you specified above. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a style for UIButtons that requires the use of a custom font. I was thinking I would set UIButton.title to a certain font ... but that doesn't seem to be possible. Do you have an example of how to set the font of a UIButton title?
The text was updated successfully, but these errors were encountered: