I am trying to change the height of a NSTextField
for a macOS application.
How can I change the height of my NSTextField
and have the text centered vertically like a normal UITextField
on iOS. I added a height constraint to try and make it bigger and nothing will change.
class LoginVC: NSViewController {
@IBOutlet weak var emailField: TF!
@IBOutlet weak var passwordField: STF!
override func viewDidLoad() {
super.viewDidLoad()
emailField.usesSingleLineMode = true
emailField.placeholderAttributedString = NSAttributedString(string: "Email", attributes: [NSForegroundColorAttributeName: NSColor.lightGray, NSFontAttributeName: NSFont(name: "Menlo", size: 20)!])
emailField.alignment = .center
passwordField.usesSingleLineMode = true
passwordField.placeholderAttributedString = NSAttributedString(string: "Password", attributes: [NSForegroundColorAttributeName: NSColor.lightGray, NSFontAttributeName: NSFont(name: "Menlo", size: 20)!])
passwordField.alignment = .center
}
override func viewWillAppear() {
super.viewWillAppear()
view.layer?.backgroundColor = EYE_GREY.cgColor
}
}