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
Bottom part of text cut off #20
Comments
FYI, had the same issue and you can fix it using NSAttributedString and
Then you need to append the textPart to the iconPart (notice the space left in the textPart string)
iconPart is now an NSAttributedString with 2 font types that will not cutoff the text :) |
hey I am also facing the same issue, but this lib, does not contain "fontAwesomeIconWithName" |
I was using a different lib (https://github.com/thii/FontAwesome.swift) but idea would be the same here since the icon is just a string |
Thank you guys for a hint how to fix it. New version of Font Awesome works great! |
If anyones wondering how to get that Attributed String into a BarButton Item (which doesnt accept multi attributed strings....) You can override the customView with a label and set it from there: let iconPart = NSMutableAttributedString(string: "\(String.fontAwesomeIcon( name: .videoCamera))", attributes: [NSAttributedStringKey.font:UIFont.fontAwesome(ofSize: 24)])
let textPart = NSMutableAttributedString(string: "Video", attributes: [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 16)])
iconPart.append(textPart)
let label = UILabel()
label.attributedText = iconPart
label.sizeToFit()
label.textColor = self.view.tintColor
let tap = UITapGestureRecognizer(target: self, action: #selector(MyViewController.tapFunction))
label.isUserInteractionEnabled = true
label.addGestureRecognizer(tap)
MyBarButton.customView = label
//elsewhere in your view Controller:
@objc
func tapFunction(sender:UITapGestureRecognizer) {
print("tap working")
} |
Changed "Logout" to "Disconnect" Vaberer/Font-Awesome-Swift#20
I'm new to iOS programming. I've noticed that if I have a prefix containing the letters "g", "p", etc, the bottom part of the text is cut off when I use font awesome icons.
Is there a workaround to that? That's Swiftybutton by the way.
The text was updated successfully, but these errors were encountered: