I have a custom inherited UIView
class with a UITableView
within it as its only subview. I'm trying to mimic the normal functionality of the UITableViewController
when the keyboard is shown to adjust the contentInset
and scrollIndicatorInsets
of the table view to the height of the keyboard. This is my method that gets called when the keyboard did show from within my custom UIView
class:
- (void)keyboardDidShow:(NSNotification*)notification
{
NSDictionary* info = [notification userInfo];
CGSize kbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
_tableView.contentInset = UIEdgeInsetsMake(0.0, 0.0, kbSize.height, 0.0);
_tableView.scrollIndicatorInsets = _tableView.contentInset;
}
This works to a certain extent, but there is still some overlap of the keyboard onto the table view for some reason by maybe ten or so pixels.
I'm thinking it has something to do with not taking into account some of the other screen geometry but I don't see how that could be. The height of the keyboard should be exactly what I need because the tableView stretches all the way to the bottom of the screen. Any ideas?