0

I would like to intercept what button/textview or #tag the user tapped when I reach the func keyboardDidShow

@objc func keyboardDidShow(notification: NSNotification) {
   
        guard let userInfo = notification.userInfo else {return}
               guard let keyboardSize = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else {return}
               let keyboardFrame = keyboardSize.cgRectValue
        
        if isheight == 0.0 { isheight = keyboardFrame.height}
     
               if self.view.bounds.origin.y == 0{
                   
                    self.view.bounds.origin.y += keyboardFrame.height
                  
                   
               }
    }

On my VC I have this line to call the func

 NotificationCenter.default.addObserver(self, selector: #selector(keyboardDidShow),name:Responder.keyboardDidShowNotification, object: nil)

Is there a possibilty ?

Victor
  • 61
  • 1
  • 13
  • In case of UITextView, you might check for each textView if they are `firstResponder`. For the button, it's unclear on how the Keyboard would show. – Larme Apr 22 '22 at 12:46
  • It's a button that allows to type characters in the screen (after you take a picture). The UITextView is for the title of the picture. I need to know which one is tapped by the user :) – Victor Apr 22 '22 at 12:55

0 Answers0