42 lines
1.4 KiB
Swift
42 lines
1.4 KiB
Swift
//
|
|
// MenuSectionHeaderView.swift
|
|
// OpenVPN
|
|
//
|
|
// Created by Viktor on 16.07.2020.
|
|
// Copyright © 2020 Privado LLC. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
final class MenuSectionHeaderView: UIView {
|
|
|
|
private enum Constants {
|
|
static let titleSectionFont = UIFont(name: "SFProText-Regular", size: 14)
|
|
static let leadingOffset: CGFloat = 16
|
|
}
|
|
|
|
class func createSectionHeaderView(title: String, textColor color: UIColor = UIColor(rgb: 0x7a86be), textAlignment alignment: NSTextAlignment = .left) -> MenuSectionHeaderView {
|
|
|
|
let view = MenuSectionHeaderView()
|
|
view.backgroundColor = UIColor(rgb: 0x00082c)
|
|
|
|
let label = UILabel()
|
|
label.translatesAutoresizingMaskIntoConstraints = false
|
|
label.font = Constants.titleSectionFont
|
|
label.textColor = color
|
|
label.text = title
|
|
label.numberOfLines = 0
|
|
label.textAlignment = alignment
|
|
view.addSubview(label)
|
|
NSLayoutConstraint.activate([
|
|
label.topAnchor.constraint(equalTo: view.topAnchor, constant: 17),
|
|
label.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: Constants.leadingOffset),
|
|
label.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -Constants.leadingOffset),
|
|
label.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -8)
|
|
])
|
|
|
|
return view
|
|
}
|
|
}
|