Search code examples
iosxcodeuitextfielddelegate

Move the UIView up when the TextField is pressed


I have 2 text fields, If I click the text fields (In portrait mode) the keyboard is not hiding the textField. But when I change to the Landscape , Then the Keyboard overlays the textFields. I don't know how to set the frame size in the delegate methods (textFieldShouldBeginEditing,textFieldShouldEndEditing )so that it will work in both portrait and landscape. OR should i use the Scroll View ?? enter image description here

enter image description here


Solution

  • I am not able to give you a 100% certain answer, both because it's a bit subjective and also because I am not able to actually see your app (print screens would be nice). But, in my opinion a UIScrollView would be a good answer. Another option is to animate your UITextField, so it can go "up" when the keyboard comes.