Created
September 10, 2015 08:30
-
-
Save GnuRant/84da17a44e46042206df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// .- | |
// `+d/ | |
// -hmm/ | |
// ommmm/ | |
// `mmmmm/ | |
// `mmmmm/ .:+ssyso+-` | |
// `mmmmmsydmmmmmmmmmho. | |
// `mmmmmmh+:---/+ssssyd: | |
// `mmmmmh. / .md- | |
// `mmmmmo..-` .ommo | |
// `mmmmm+..` ./oydmmm/ | |
// `mmmmm/ /dmmmmmmh` | |
// `mmmmm/ `smmmmmmms` | |
// `mmmmm/ `+dmmmmmy+. | |
// :::::. `-::-.` | |
// | |
// Created by Luca D'incà on 10/09/15. | |
// Copyright (c) 2015 B3LAB. All rights reserved. | |
// | |
// UILabel+Lineheight.swift | |
// Quartzforms | |
// | |
import UIKit | |
extension UILabel { | |
func setLineHeight(lineHeight: CGFloat) { | |
let text = self.text | |
if let text = text { | |
let attributeString = NSMutableAttributedString(string: text) | |
let style = NSMutableParagraphStyle() | |
style.lineSpacing = lineHeight | |
attributeString.addAttribute(NSParagraphStyleAttributeName, value: style, range: NSMakeRange(0, count(text))) | |
self.attributedText = attributeString | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated line 36 with
Swift 5