0

I've layed out a view with some labels, a button and especially a text field in the bottom of this view. The issue is when the text field gets the focus, the iphone virtual keyboard hides the text field, so we can't see what we're typing (and I can't move the text field to another part without breaking this layout)...Any idea on how to fix this issue ?

Thx for helping,

Stephane

Stephane
  • 4,978
  • 9
  • 51
  • 86
  • possible duplicate of [How to make a UITextField move up when keyboard is present](http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present) – progrmr Sep 10 '11 at 14:25

1 Answers1

5

There is a method of textFieldDelegate calld

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField

When this method gets called you can change frame property of you UIView and shift it upward.

Same way when textFieldShouldEndEditing gets called you can shift view down again.

Moreover, listing to notification UIKeyboardWillShowNotification and UIKeyboardWillHideNotification can also be useful to trigger view shifing.

If you do not know how to slide view see this.

http://iosdevelopertips.com/user-interface/sliding-views-on-and-off-screen-reader-contributions.html

Cœur
  • 37,241
  • 25
  • 195
  • 267
Mohammad
  • 1,636
  • 1
  • 13
  • 17
  • This is a good way to handle it, but I got tired of customizing the field shifting and created [GMKeyboardVC](http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present/7372464#7372464), a subclass of UIViewController that does all that. – progrmr Sep 10 '11 at 14:51