blob: a8428982fe77ac1361898113b4d0f8da968a753b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
//
// SelectLocationHeaderView.swift
// MullvadVPN
//
// Created by pronebird on 22/07/2020.
// Copyright © 2020 Mullvad VPN AB. All rights reserved.
//
import UIKit
class SelectLocationHeaderView: UIView {
lazy var textContentLabel: UILabel = {
let textLabel = UILabel()
textLabel.translatesAutoresizingMaskIntoConstraints = false
textLabel.font = UIFont.systemFont(ofSize: 17)
textLabel.textColor = UIColor(white: 1, alpha: 0.6)
textLabel.numberOfLines = 0
textLabel.text = NSLocalizedString(
"SUBHEAD_LABEL",
tableName: "SelectLocation",
comment: "Subhead label displayed below navigation title."
)
return textLabel
}()
var topLayoutMarginAdjustmentForNavigationBarTitle: CGFloat = 0 {
didSet {
let value = UIMetrics.sectionSpacing - topLayoutMarginAdjustmentForNavigationBarTitle
layoutMargins.top = max(value, 0)
}
}
init() {
super.init(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
backgroundColor = .secondaryColor
layoutMargins = UIMetrics.contentLayoutMargins
insetsLayoutMarginsFromSafeArea = false
addSubview(textContentLabel)
NSLayoutConstraint.activate([
textContentLabel.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor),
textContentLabel.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor),
textContentLabel.trailingAnchor.constraint(equalTo: layoutMarginsGuide.trailingAnchor),
textContentLabel.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor)
])
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
|