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?
            Asked
            
        
        
            Active
            
        
            Viewed 112 times
        
    1 Answers
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
- 
                    i don't have searchBar ! a have just imageView and two textFields and button ! Below screenshot https://ru.files.fm/u/ayr26uyc https://ru.files.fm/u/rdfm2e7k – AlexLeo Apr 24 '19 at 18:59
- 
                    
- 
                    
- 
                    I apply this solution, but when I start typing my screen more up and appears black lines in bottom. objc func keyboardWillShow(sender: NSNotification) { self.view.frame.origin.y -= 150 } @objc func keyboardWillHide(sender: NSNotification) { self.view.frame.origin.y += 150 } – AlexLeo Apr 25 '19 at 07:23
- 
                    
- 
                    
- 
                    
- 
                    
- 
                    
- 
                    what I should past instead of logoImage and searchBar in your example ? – AlexLeo Apr 29 '19 at 12:58
