I've been working on a project in swift, and I found an answer in objective c that perfectly does what I'd like. The solution I've been using is answered by mig70 in the post Resize and move UITableViewCell smoothly without dismissing keyboard. I've gotten most of it converted to swift, but part of the answer uses the property self.activeKeyboardSize.
There appear to be two bits of code I'm struggling with. Here is the first:
- (void) keyboardDidHide:(NSNotification *)notification {
if (self.tableView.contentInset.bottom != 0)
[UIView animateWithDuration:0.5 animations:^ {self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);}];
self.activeKeyboardSize = CGSizeZero; }
And here is the second
- (void) keyboardDidShow:(NSNotification*)notification {
NSDictionary* info = [notification userInfo];
self.activeKeyboardSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
CGFloat tableViewBottom = self.tableView.frame.origin.y + self.tableView.frame.size.height;
CGFloat keyboardTop = self.view.frame.size.height - self.activeKeyboardSize.height;
CGFloat coveringVerticalSpace = tableViewBottom - keyboardTop;
if (coveringVerticalSpace <= 0)
return;
TableViewScrollDirection scrollDirection = [self scrollToKeepEditingCellVisibleAboveVerticalPoint:self.tableView.frame.size.height - coveringVerticalSpace - UI_MARGIN_DEFAULT anchorsToVerticalPoint:NO];
if (scrollDirection == TableViewScrollUp)
self.textControlCellHadToMoveUpToBeVisibleOverKeyboard = YES;}
The answer given doesn't state anywhere where these properties are declared or how they work.
I can't find anything in either swift or objective c that might allow me to actively change the keyboard size as demonstrated. It makes me think that it's a property that's been added in an extension. How could I go about gaining access to a property that does what is demonstrated in the answer?
Thank you!