I am developing a chat app and i found a problem when keyboard appear method. I am using UIKeyboardDidShowNotification to move my chat textview and button on top of the keyboard. But my chat textview is hidden by word sugesstion tool bar when showing word suggestion or changing keyboard to other language like Japanese. Keyboard height got by UIKeyboardNotification is late. And so, how to detect that suggestion toolbar is shown or not?
- (void)keyboardWasShown:(NSNotification*)aNotification
{
NSDictionary *userInfo = [aNotification userInfo];
CGSize kbSize = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
CGRect rectTable = rTable;
rectTable.origin.y -= kbSize.height;
CGRect rectToolBar = rToolbar;
rectToolBar.origin.y -= kbSize.height;
[UIView animateWithDuration:0.25f
animations:^{
[self.tableView setFrame:rectTable];
[self.toolBar setFrame:rectToolBar];
}
];
}
If changing textview location doen't work, is there another way to put textview on top of the keyboard?
Instead of using this,
CGSize kbSize = [[userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
try this
CGSize kbSize = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With