0

I create template authorization page with password and login! I placed textfields(password and login) on top of imageView, is it possible to realize that the keyboard does not overlap with the imageView without scrollView?

AlexLeo
  • 89
  • 1
  • 1
  • 9

1 Answers1

2

When user click textField you can call this function:

func textFieldDidBeginEditing(_ textField: UITextField) {
    UIView.animate(withDuration: 0.3) {
        self.logoImage.center.y = self.logoImage.center.y - 70
        self.searchBar.center.y = self.searchBar.center.y - 70
        self.view.layoutIfNeeded()
    }
}

When user stop typing everything will be same before not editing

func textFieldDidEndEditing(_ textField: UITextField) {
        UIView.animate(withDuration: 0.3) {
            self.view.bounds.origin.y = 0
            self.view.layoutIfNeeded()
        }
    }
Sadi Hakan
  • 231
  • 3
  • 15