adjust scroll indicator insets

This commit is contained in:
Sami Samhuri 2015-05-21 10:44:01 -04:00
parent 477a7939ed
commit b4a1b208bb
2 changed files with 12 additions and 4 deletions

View file

@ -240,6 +240,9 @@
UIEdgeInsets inset = self.textView.contentInset; UIEdgeInsets inset = self.textView.contentInset;
inset.bottom = bottomInset; inset.bottom = bottomInset;
self.textView.contentInset = inset; 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? // TODO: put the selection in the middle somehow ... can we get the point/rect for the selection?
[self.textView scrollRangeToVisible:self.textView.selectedRange]; [self.textView scrollRangeToVisible:self.textView.selectedRange];
} }

View file

@ -365,15 +365,20 @@ static const NSUInteger SectionPublished = 1;
- (void)keyboardWillShow:(NSNotification *)note { - (void)keyboardWillShow:(NSNotification *)note {
NSValue *keyboardFrame = note.userInfo[UIKeyboardFrameEndUserInfoKey]; NSValue *keyboardFrame = note.userInfo[UIKeyboardFrameEndUserInfoKey];
CGFloat keyboardHeight = keyboardFrame.CGRectValue.size.height; CGFloat keyboardHeight = keyboardFrame.CGRectValue.size.height;
UIEdgeInsets inset = self.tableView.contentInset; [self adjustTableViewBottomInsets:keyboardHeight];
inset.bottom = keyboardHeight;
self.tableView.contentInset = inset;
} }
- (void)keyboardWillHide:(NSNotification *)note { - (void)keyboardWillHide:(NSNotification *)note {
[self adjustTableViewBottomInsets:0];
}
- (void)adjustTableViewBottomInsets:(CGFloat)bottom {
UIEdgeInsets inset = self.tableView.contentInset; UIEdgeInsets inset = self.tableView.contentInset;
inset.bottom = 0; inset.bottom = bottom;
self.tableView.contentInset = inset; self.tableView.contentInset = inset;
inset = self.tableView.scrollIndicatorInsets;
inset.bottom = bottom;
self.tableView.scrollIndicatorInsets = inset;
} }
#pragma mark - Blog notificitons #pragma mark - Blog notificitons