forked from zelo72/mastodon-ios
fix: update appearance for text field and title label in register scene
This commit is contained in:
parent
0e4d1d8338
commit
1c1189df7d
|
@ -118,8 +118,35 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
|
||||||
attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color,
|
attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color,
|
||||||
NSAttributedString.Key.font: MastodonRegisterViewController.textFieldLabelFont])
|
NSAttributedString.Key.font: MastodonRegisterViewController.textFieldLabelFont])
|
||||||
textField.borderStyle = UITextField.BorderStyle.roundedRect
|
textField.borderStyle = UITextField.BorderStyle.roundedRect
|
||||||
|
textField.font = MastodonRegisterViewController.textFieldLabelFont
|
||||||
|
textField.leftView = {
|
||||||
|
let containerView = UIView()
|
||||||
|
|
||||||
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: textField.frame.height))
|
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: textField.frame.height))
|
||||||
textField.leftView = paddingView
|
paddingView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
containerView.addSubview(paddingView)
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
paddingView.topAnchor.constraint(equalTo: containerView.topAnchor),
|
||||||
|
paddingView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor),
|
||||||
|
paddingView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor),
|
||||||
|
paddingView.widthAnchor.constraint(equalToConstant: 5).priority(.defaultHigh),
|
||||||
|
])
|
||||||
|
|
||||||
|
let label = UILabel()
|
||||||
|
label.font = MastodonRegisterViewController.textFieldLabelFont
|
||||||
|
label.textColor = Asset.Colors.Label.primary.color
|
||||||
|
label.text = " @"
|
||||||
|
|
||||||
|
label.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
containerView.addSubview(label)
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
label.topAnchor.constraint(equalTo: containerView.topAnchor),
|
||||||
|
label.leadingAnchor.constraint(equalTo: paddingView.trailingAnchor),
|
||||||
|
label.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
|
||||||
|
label.bottomAnchor.constraint(equalTo: containerView.bottomAnchor),
|
||||||
|
])
|
||||||
|
return containerView
|
||||||
|
}()
|
||||||
textField.leftViewMode = .always
|
textField.leftViewMode = .always
|
||||||
return textField
|
return textField
|
||||||
}()
|
}()
|
||||||
|
@ -144,6 +171,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
|
||||||
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: textField.frame.height))
|
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: textField.frame.height))
|
||||||
textField.leftView = paddingView
|
textField.leftView = paddingView
|
||||||
textField.leftViewMode = .always
|
textField.leftViewMode = .always
|
||||||
|
textField.font = MastodonRegisterViewController.textFieldLabelFont
|
||||||
return textField
|
return textField
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -161,6 +189,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
|
||||||
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: textField.frame.height))
|
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: textField.frame.height))
|
||||||
textField.leftView = paddingView
|
textField.leftView = paddingView
|
||||||
textField.leftViewMode = .always
|
textField.leftViewMode = .always
|
||||||
|
textField.font = MastodonRegisterViewController.textFieldLabelFont
|
||||||
return textField
|
return textField
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -186,6 +215,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
|
||||||
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: textField.frame.height))
|
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: textField.frame.height))
|
||||||
textField.leftView = paddingView
|
textField.leftView = paddingView
|
||||||
textField.leftViewMode = .always
|
textField.leftViewMode = .always
|
||||||
|
textField.font = MastodonRegisterViewController.textFieldLabelFont
|
||||||
return textField
|
return textField
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -216,6 +246,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
|
||||||
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: textField.frame.height))
|
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: textField.frame.height))
|
||||||
textField.leftView = paddingView
|
textField.leftView = paddingView
|
||||||
textField.leftViewMode = .always
|
textField.leftViewMode = .always
|
||||||
|
textField.font = MastodonRegisterViewController.textFieldLabelFont
|
||||||
return textField
|
return textField
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue