In my iPhone apps, my problem is that I have a textfield at the bottom of the screen, so when the keyboard appear, he hides the textfied, there is a way to show the keyboard on the top of the screen?
Asked
Active
Viewed 1,456 times
4
-
Possible duplicate of: http://stackoverflow.com/questions/1247113/iphone-keyboard-covers-text-field – iwasrobbed Aug 02 '10 at 21:10
-
Please [don't add signatures or taglines to your posts](http://stackoverflow.com/faq#signatures). – user229044 May 15 '12 at 16:14
2 Answers
4
You should move your view when the keyboard appears. The code is:
In .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 .h file
- (void) loginViewUp : (UIView*) view;
here
#define View_Move_Hight 170
is defined before @implementation
.

Jonathan Leffler
- 730,956
- 141
- 904
- 1,278

Arsalan
- 51
- 2
2
You should design your view so that it shifts up with the keyboard, iPhone users are used to the keyboard always being on the bottom of the screen so this would go against the HIG

Chris Wagner
- 20,773
- 8
- 74
- 95