For my keyboards to move up to uncover UITextField
in my iOS app, I used to implement this answer: https://stackoverflow.com/a/6908258/3855618 on iOS7 and 8 and it
Devoid of hacks, kludges, workaround and listeners.
The present question has been asked over and over since the dawn of iOS time. No answer on StackOverflow survived more than 2 iOS iterations. Rightly so, because the UIKit keeps changing from underneath your feet. There exists a design as opposed to implementation solution to this ancient problem. Use a UITableViewController
.
Use a UITableViewController
When a UITableView
is managed by a UITableViewController
, the scrolling is managed automatically for you. Never tinker with UIKeyboardWillShowNotification
, ever again. Merely create static or dynamic UITableViewCells
to layout your interface, add UITextView
or UITextField
as needed ; merely becoming first responder will scroll the the proper location.
@availability(iOS, introduced=2.0)
Notes