Caps-iOS/Caps/Extensions/UINavigationItem+Extensions.swift

32 lines
828 B
Swift
Raw Normal View History

2020-05-16 11:21:55 +02:00
//
// UINavigationItem+Extensions.swift
// CapCollector
//
// Created by Christoph on 12.05.20.
// Copyright © 2020 CH. All rights reserved.
//
import UIKit
extension UINavigationItem {
func setTitle(_ title: String, subtitle: String) {
let titleLabel = UILabel()
titleLabel.text = title
titleLabel.font = .systemFont(ofSize: 17.0)
titleLabel.textColor = .black
let subtitleLabel = UILabel()
subtitleLabel.text = subtitle
subtitleLabel.font = .systemFont(ofSize: 12.0)
subtitleLabel.textColor = .gray
let stackView = UIStackView(arrangedSubviews: [titleLabel, subtitleLabel])
stackView.distribution = .equalCentering
stackView.alignment = .center
stackView.axis = .vertical
self.titleView = stackView
}
}