Posts

Post not yet marked as solved
3 Replies
1.1k Views
let categoryField: UITextField = { let field = UITextField() field.layer.borderWidth = 0.5 field.layer.borderColor = UIColor.gray.withAlphaComponent(0.5).cgColor field.layer.cornerRadius = 5 field.textAlignment = .center field.selectedTextRange = nil field.placeholder = "Enter Title" field.heightAnchor.constraint(equalToConstant: 50).isActive = true field.translatesAutoresizingMaskIntoConstraints = false field.autocorrectionType = .no field.autocapitalizationType = .words return field }()Which is used below, inside of a viewDidLoad method in a viewController.let stackView = UIStackView(arrangedSubviews: [ categoryField, UIView() ]) stackView.isUserInteractionEnabled = true stackView.axis = .vertical stackView.alignment = .fill stackView.spacing = 8It works on Simulator, but when I take the code to a device it doesn't work at all. I've used the same code in other apps and they worked fine. Any thoughts on why it won't work in this?
Posted Last updated
.