If you ever find yourself in a situation where you had to build UI from specifications designed in Figma, Sketch, Adobe XD or anything similar, then chances are that you already came across text labels with customized line height and letter spacing values specified. See UILabel_Typography_Extensions at GitHub Motivation HeaderLabel.font = UIFont(name: "HelveticaNeue-CondensedBlack", size: 100) HeaderLabel.textColor = UIColor(named: "Mars") However, following along with how the extension is created, being introduced to the context can possibly leave you with a more reusable knowledge, applicable across a wider range of potential use cases in the future. You can just grab the project code at GitHub, and start using the extension. This article introduces UILabel extension that helps you to set line height, letter spacing (and more) for UILabelinstances. Having these additions, line height settings will be preserved between text updates, while you can also implement text styles from design specifications with ease. ![]() With this UILabel extension you can directly set line height, letter spacing, underline, and strikethrough properties on any label. With this article, you can create an extension that enables not only line height, but setting letter spacing, underline, strikethrough in code simply by setting a property. Setting UILabel line height on a should be as simple as setting its color.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |