Pergunta

I am using few UITextFields with different inputviews using Keyboards, Pickerviews etc in my iPad App. Normally inputview should appear from the bottom of the screen but most of the times it appears from above the bottom - about 50 pixels. I have attached couple of snapshots for this. This is happening very randomly, but when happens once, it does same for all UITextFields. Could anyone please tell me what are the factors affect this and how to get rid of this issue? I want inputview to appear from bottom of the screen always. Please note that I don't have navigation controller, I use presentviewmodel through out my App, and have a customised navigation controller look like bottom! Thanks.

* I have noticed that this happens even for Google Map while selecting From and To Textfields. This must be something weird! *

I am making sure that selected textview always resignfirstresponder by following methods.

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    selectedTextField = textField;
    return YES;
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return YES;
}

- (void)textFieldDidEndEditing:(UITextField *)textField
{
    [textField resignFirstResponder];
}

- (void)donePickerViewButtonPressed
{
    [selectedTextField resignFirstResponder];
}

Keyboard appears 50 pixels above the bottom of screen!

PickerView UITextField inputview appears 50 pixels above the bottom of screen!

Foi útil?

Solução

I am surprised I figured this out by playing with Keyboard's settings. In Settings->General->Keyboard->Switch off "Split Keyboard" and it worked! I have confirmed by testing switching this key on and off. When Off, keyboard or any inputviews appear from the botton of screen. When ON, keyboard/inputview appears about 50 pixels up from bottom of the screen. Not sure what's the relation with it though!!

Outras dicas

Its because you have not resignFirstResponder your textFeild before using picker or Vice Versa.So whenever u press Done button resign your all textFeilds and when u open picker resign all textFeilds.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top