- Set label's position.
After you add the label to subViews of your view. You need to set it's position by using constraint like this:
top_error_rep.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
top_error_rep.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
top_error_rep.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
top_error_rep.heightAnchor.constraint(equalToConstant: 20).isActive = true
or you can use different way. Google for Auto layout programmatically swift
- Make it only show when user input is less than 6 characters
How do I check when a UITextField changes?
This may helps you
EDIT
add this to your ViewController to hide the status bar
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
//Add below line.....
UIApplication.shared.isStatusBarHidden = true
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
//It will show the status bar again after dismiss
UIApplication.shared.isStatusBarHidden = false
}
override var prefersStatusBarHidden: Bool {
return true
}