Skip to content

Instantly share code, notes, and snippets.

@krzyzanowskim
Last active July 13, 2023 09:02
Show Gist options
  • Save krzyzanowskim/4da942064d9633c5f688c6a54f88e1cc to your computer and use it in GitHub Desktop.
Save krzyzanowskim/4da942064d9633c5f688c6a54f88e1cc to your computer and use it in GitHub Desktop.
//
// 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