Last active
July 13, 2023 09:02
-
-
Save krzyzanowskim/4da942064d9633c5f688c6a54f88e1cc 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
// | |
// MultilineLabel.swift | |
// | |
// Created by Marcin Krzyzanowski on 19/09/2019. | |
// | |
import UIKit | |
public class MultilineLabel: UILabel { | |
override public init(frame: CGRect) { | |
super.init(frame: frame) | |
self.adjustsFontForContentSizeCategory = true | |
self.numberOfLines = 0 | |
} | |
required public init?(coder aDecoder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
override public func layoutSubviews() { | |
self.preferredMaxLayoutWidth = self.frame.width | |
super.layoutSubviews() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment