From b4a1b208bbf51b7af2f764b1e857cc3b0e8ae1cc Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Thu, 21 May 2015 10:44:01 -0400 Subject: [PATCH] adjust scroll indicator insets --- Blog/EditorViewController.m | 3 +++ Blog/PostsViewController.m | 13 +++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Blog/EditorViewController.m b/Blog/EditorViewController.m index e50edef..da7836b 100644 --- a/Blog/EditorViewController.m +++ b/Blog/EditorViewController.m @@ -240,6 +240,9 @@ UIEdgeInsets inset = self.textView.contentInset; inset.bottom = bottomInset; self.textView.contentInset = inset; + inset = self.textView.scrollIndicatorInsets; + inset.bottom = bottomInset; + self.textView.scrollIndicatorInsets = inset; // TODO: put the selection in the middle somehow ... can we get the point/rect for the selection? [self.textView scrollRangeToVisible:self.textView.selectedRange]; } diff --git a/Blog/PostsViewController.m b/Blog/PostsViewController.m index d3e4c7d..767ef3b 100644 --- a/Blog/PostsViewController.m +++ b/Blog/PostsViewController.m @@ -365,15 +365,20 @@ static const NSUInteger SectionPublished = 1; - (void)keyboardWillShow:(NSNotification *)note { NSValue *keyboardFrame = note.userInfo[UIKeyboardFrameEndUserInfoKey]; CGFloat keyboardHeight = keyboardFrame.CGRectValue.size.height; - UIEdgeInsets inset = self.tableView.contentInset; - inset.bottom = keyboardHeight; - self.tableView.contentInset = inset; + [self adjustTableViewBottomInsets:keyboardHeight]; } - (void)keyboardWillHide:(NSNotification *)note { + [self adjustTableViewBottomInsets:0]; +} + +- (void)adjustTableViewBottomInsets:(CGFloat)bottom { UIEdgeInsets inset = self.tableView.contentInset; - inset.bottom = 0; + inset.bottom = bottom; self.tableView.contentInset = inset; + inset = self.tableView.scrollIndicatorInsets; + inset.bottom = bottom; + self.tableView.scrollIndicatorInsets = inset; } #pragma mark - Blog notificitons