Question

I have a modal popup which is placed behind the keyboard.

How can I move the modal popup to a higher position?

enter image description here

Was it helpful?

Solution

This is work around to get rid of mentioned situation.

I assume you are using becomeFirstResponder for textField. Write below code in class which is presented modally.

-(void)viewDidAppear:(BOOL)animated{
    [self performSelector:@selector(txtFieldResponder) withObject:nil afterDelay:0.1];
}

-(void)txtFieldResponder{
    [self.txt becomeFirstResponder];
}

Hope this helps.

OTHER TIPS

Use this:

Register class for keyboard show and hide notification

NSNotificationCenter        *center = [NSNotificationCenter defaultCenter];
        [center addObserver:self selector:@selector(showKeyboard:) name:UIKeyboardDidShowNotification object:nil];
        [center addObserver:self selector:@selector(hideKeyboard:) name:UIKeyboardWillHideNotification object:nil];

Then implement

- (void)showKeyboard:(NSNotification *)notification {

//Change popup frame here 
}


- (void)hideKeyboard:(NSNotification *)notification {
//Change popup frame to previous state 

}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top