Handling the Keyboard

You have not yet finished making the edit scene work in all screen sizes and orientations. The problem is that the keyboard sometimes covers at least one of the input lines, and there is no layout that works in all orientations and screen sizes with the keyboard open.

The solution is to put the view with the fields inside a UIScrollView. When the screen is big enough to show everything—that is, when the scroll view is large enough to show all the content—it only bounce scrolls (or not, if the Bounce Vertically check box is unchecked). The user cannot accidentally move the content off the screen. But when the keyboard opens, you resize the scroll view to be above the keyboard. The content view stays the same size, so the ...

Get Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.