title: UI Elements Moving When Character Typed In Text Field
body: <p>When a user selects the bottom text field all elements in the view move up by the height of the keyboard until the user dismisses the keyboard. </p>
  
  <p>The problem occurs after the user selects the bottom text field.  Initially the elements all move up correctly.  However, when the first character is typed by the user all of the elements move back down to the original position.  As a result, the user can no longer see the text field they are editing.  Once the user dismisses the keyboard they see the elements go up where they should have been, and then come right back down to the original position.</p>
  
  <p>I have narrowed down what is causing the issue, but I do not understand why it is happening.  My project can be found on GitHub at <a href="https://github.com/JMNolan/memesicle" rel="nofollow noreferrer">https://github.com/JMNolan/memesicle</a></p>
  
  <p>I am still very new to Swift and fairly new to coding in general, so all help is really appreciated. I have also included the code snippets below that are relevant to this process for anyone who does not want to use GitHub</p>
  
  <p>This is what moves the elements up the height of the keyboard</p>
  
  <pre><code>//moves the view up when the keyboard appears to keep the text field 
  visible
      @objc func keyboardWillShow (notification: NSNotification){
          if bottomTextFieldActive == true{
              keyboardHeight = getKeyboardHeight(notification: 
  notification)
              imagePickerView.frame.origin.y -= keyboardHeight
              topText.frame.origin.y -= keyboardHeight
              bottomText.frame.origin.y -= keyboardHeight
              toolbar.frame.origin.y -= keyboardHeight
          }
      }
  </code></pre>
  
  <p>This is what moves the elements back down the height of the keyboard when the keyboard is dismissed</p>
  
  <pre><code>//moves the view down when the keyboard is dismissed to show the full view again
  @objc func keyboardWillHide (notification: NSNotification){
      imagePickerView.frame.origin.y += keyboardHeight
      topText.frame.origin.y += keyboardHeight
      bottomText.frame.origin.y += keyboardHeight
      toolbar.frame.origin.y += keyboardHeight
      //shareButton.frame.origin.y += keyboardHeight
      print("keyboard just hid")
  }
  </code></pre>
  
  <p>This is what calls the function above</p>
  
  <pre><code>func subscribeToKeyboardNotifications(){
          NotificationCenter.default.addObserver(self, selector: 
  #selector(keyboardWillShow), name: 
  NSNotification.Name.UIKeyboardWillShow, object: nil)
  
          NotificationCenter.default.addObserver(self, selector: 
   #selector(keyboardWillHide), name: 
  NSNotification.Name.UIKeyboardWillHide, object: nil)
      }
  </code></pre>
  
  <p>This is how I get the keyboardHeight used when moving the elements up and down the height of the keyboard.</p>
  
  <pre><code>//get the height of the keyboard to determine how far up to move the view when editing the bottom text field
  func getKeyboardHeight(notification: NSNotification) -&gt; CGFloat {
      let userinfo = notification.userInfo
      let keyboardSize = userinfo![UIKeyboardFrameEndUserInfoKey] as!NSValue
      return keyboardSize.cgRectValue.height
  }
  </code></pre>