I am new to ios/swift and not sure what to do when it comes to text fields / keyboard.
When I click on a textfield the keyboard blocks/covers it, so I cant select it or any other text field bellow it.
So what is the best solution for this? Beside wrapping everything in a scrollview.
I found this snippet but im not sure on how to implement it:
func textFieldDidBeginEditing(textField: UITextField) {
animateViewMoving(true, moveValue: 100)
}
func textFieldDidEndEditing(textField: UITextField) {
animateViewMoving(false, moveValue: 100)
}
func animateViewMoving (up:Bool, moveValue :CGFloat){
var movementDuration:NSTimeInterval = 0.3
var movement:CGFloat = ( up ? -moveValue : moveValue)
UIView.beginAnimations( "animateView", context: nil)
UIView.setAnimationBeginsFromCurrentState(true)
UIView.setAnimationDuration(movementDuration )
self.view.frame = CGRectOffset(self.view.frame, 0, movement)
UIView.commitAnimations()
}
Or if someone has a good code example/library from github, please share :)
Thanks in advance,