banditKing
banditKing

Reputation: 9579

UIScrollview implemented, but UITextfields still covered by keyboard

I have gone through most of the posts here and on the internet. I did find a lot of the answers I was looking but one problem remains and I am not sure how to solve it: Basically, I have a setup in IB as follows: enter image description here

There are several text fields that the user fills in one by one. However when the user finishes with the "City" text field, he has to press "DONE" on the keyboard to resign it, only then can he go to the "Telephone" field and fill the rest. I have implemnted the method to move the view up when the user starts editing the "Telephone" field but that only happens when the "Telephone" field is clicked. But, going from top to bottom, after finishing the "City" field, the user doesn't even see the "Telephone" field, so how can he click on it and consquently, how can the view move up? Im confused. I have implemented a scroll view but when I try to scroll the screen up nothing happens. enter image description here

enter image description here

enter image description here

Upvotes: 2

Views: 3889

Answers (3)

SVD
SVD

Reputation: 4753

Just scrolling won't help here - you need to resize the whole view.

Subscribe to UIKeyboardWillShowNotification, UIKeyboardWillHideNotification notifications and resize the scroll view there: make it smaller by the keyboard size when the keyboard is shown, and larger when it goes away. You can get the keyboard size by getting the value under UIKeyboardFrameBeginUserInfoKey key in the notification's userInfo.

Upvotes: 1

Related Questions