background preloader

Divers tuto / à trier

Facebook Twitter

On iPhone UITextField auto-scroll « The Loop. During my early days of iPhone development, I came across this specific problem: How the heck do I auto-scroll the text fields behind the keyboard? Here’s a visual of what I mean. Suppose I have a text field named Rate as shown on image above. As soon as I click on this field, it will automatically launch the system keyboard of iPhone. iPhone’s keyboard launches from the bottom of screen going up, so it will block my view of the Rate field while I’m typing on it. Iphone - How to make a UITextField move up when keyboard is present. Iphone - UITableView and keyboard scrolling issue. Iphone - UITableView and keyboard scrolling issue. Sliding UITextFields around to avoid the keyboard.

Hidden text fields The iPhone's onscreen keyboard occupies the bottom 216 pixels on screen (162 in landscape mode).

Sliding UITextFields around to avoid the keyboard

That's around half the screen, so if you ever have a text field you want to edit in the bottom half of the screen, it needs to move or it will get covered. You can just animate the whole window upwards by the height of the keyboard when editing a text field in the bottom half but this doesn't work well for text fields in the middle (they can get moved too far up). Instead, I'm going to show you a method which divides the window as follows: Everything in the top section will stay still when edited.