Show text field keyboard at the top of the screen

In my iPhone apps, my problem is that I have a text box at the bottom of the screen, so when the keyboard appears, it hides the text, is there a way to show the keyboard at the top of the screen?

+4
source share
2 answers

You must move your view when the keyboard appears. The code:

In the .m file

- (void) loginViewUp : (UIView*) view { if(!alreadyViewUp) { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.3]; CGRect rect = view.frame; rect.origin.y -= View_Move_Hight; view.frame = rect; [UIView commitAnimations]; alreadyViewUp = !alreadyViewUp; } } - (void) loginViewDown :(UIView*) view { if(alreadyViewUp) { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.3]; CGRect rect = view.frame; rect.origin.y += View_Move_Hight; view.frame = rect; [UIView commitAnimations]; alreadyViewUp = !alreadyViewUp; } } 

In the .h file

 - (void) loginViewUp : (UIView*) view; 

here

 #define View_Move_Hight 170 

defined before @implementation .

+4
source

You have to design your presentation so that it moves from the keyboard, iPhone users are accustomed to the keyboard, always at the bottom of the screen, so that it will go against HIG

+2
source

All Articles