Add title and subtitle (#540)

This commit is contained in:
Nathan Mattes 2022-11-10 18:32:00 +01:00
parent e05b595aed
commit 38317d8fa6
2 changed files with 28 additions and 1 deletions

View File

@ -10,18 +10,39 @@ import MastodonAsset
class MastodonLoginView: UIView {
// Title, Subtitle
// SearchBox, queries api.joinmastodon.org/servers with domain
// List with (filtered) domains
let titleLabel: UILabel
let subtitleLabel: UILabel
private let headerStackView: UIStackView
let navigationActionView: NavigationActionView
override init(frame: CGRect) {
titleLabel = UILabel()
titleLabel.font = MastodonLoginViewController.largeTitleFont
titleLabel.textColor = MastodonLoginViewController.largeTitleTextColor
titleLabel.text = "Welcome Back" //TODO: @zeitschlag localization
titleLabel.numberOfLines = 0
subtitleLabel = UILabel()
subtitleLabel.font = MastodonLoginViewController.subTitleFont
subtitleLabel.textColor = MastodonLoginViewController.subTitleTextColor
subtitleLabel.text = "Log you in with the server where you created your account" //TODO: @zeitschlag localization
subtitleLabel.numberOfLines = 0
headerStackView = UIStackView(arrangedSubviews: [titleLabel, subtitleLabel])
headerStackView.axis = .vertical
headerStackView.spacing = 16
headerStackView.translatesAutoresizingMaskIntoConstraints = false
navigationActionView = NavigationActionView()
navigationActionView.translatesAutoresizingMaskIntoConstraints = false
super.init(frame: frame)
addSubview(headerStackView)
addSubview(navigationActionView)
backgroundColor = .systemBackground
@ -34,6 +55,11 @@ class MastodonLoginView: UIView {
private func setupConstraints() {
let constraints = [
headerStackView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor),
headerStackView.leadingAnchor.constraint(equalTo: readableContentGuide.leadingAnchor),
headerStackView.trailingAnchor.constraint(equalTo: readableContentGuide.trailingAnchor),
navigationActionView.leadingAnchor.constraint(equalTo: leadingAnchor),
navigationActionView.trailingAnchor.constraint(equalTo: trailingAnchor),
bottomAnchor.constraint(equalTo: navigationActionView.bottomAnchor),

View File

@ -43,6 +43,7 @@ class MastodonLoginViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
defer { setupNavigationBarBackgroundView() }
setupOnboardingAppearance()
}