I'm using LayoutKit to create a Form which is centered in the screen.
All works great, however I need to reposition the form layout, which is in a sublayout when a form field is selected due to the keyboard coming onto screen.
Other than keeping a reference to the view and remaking the layout, is there a 'right' way to reposition?
The issue I am having right now is that when I remake the views the textfield used within the form loses focus, so they keyboard immediately hides again.
func keyboardWillShow(notification: NSNotification) {
if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue {
print("Show")
if let mainLayout = mainLayout {
mainLayout.arrangement(height: view.frame.height - keyboardSize.height).makeViews(in: view)
}
}
}
func keyboardWillHide(notification: NSNotification) {
print("Hide")
if let mainLayout = mainLayout {
mainLayout.arrangement(width: view.frame.width, height: view.frame.height).makeViews(in: view)
}
}
I'm using LayoutKit to create a Form which is centered in the screen.
All works great, however I need to reposition the form layout, which is in a sublayout when a form field is selected due to the keyboard coming onto screen.
Other than keeping a reference to the view and remaking the layout, is there a 'right' way to reposition?
The issue I am having right now is that when I remake the views the textfield used within the form loses focus, so they keyboard immediately hides again.