From ef14f3d8e72a53e7b6d656b059bfe819cc0f08e4 Mon Sep 17 00:00:00 2001 From: Tom Baranes Date: Tue, 29 Mar 2016 09:49:18 +0200 Subject: [PATCH] Improving auto-adjust fittable label --- Source/FittableFontLabel.swift | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/FittableFontLabel.swift b/Source/FittableFontLabel.swift index 650031f..7839fc1 100644 --- a/Source/FittableFontLabel.swift +++ b/Source/FittableFontLabel.swift @@ -51,14 +51,21 @@ import UIKit // MARK: Life cycle - override init(frame: CGRect) { - super.init(frame: frame) + public override func prepareForInterfaceBuilder() { + super.prepareForInterfaceBuilder() + adjustFontSize() } - required public init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) + public override func awakeFromNib() { + super.awakeFromNib() + adjustFontSize() } - + + public override func layoutSubviews() { + super.layoutSubviews() + adjustFontSize() + } + // MARK: private func adjustFontSize() {