Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Keep scroll view content inset adjustment #643

Merged
merged 1 commit into from
Nov 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions Source/SLKTextViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,8 @@ - (UITableView *)tableViewWithStyle:(UITableViewStyle)style
_tableView.dataSource = self;
_tableView.delegate = self;
_tableView.clipsToBounds = NO;

// Deactivate automatic scrollView adjustment
if (@available(iOS 11.0, *)) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}

[self slk_updateInsetAdjustmentBehavior];
}
return _tableView;
}
Expand Down Expand Up @@ -565,6 +562,7 @@ - (void)setInverted:(BOOL)inverted
}

_inverted = inverted;
[self slk_updateInsetAdjustmentBehavior];

self.scrollViewProxy.transform = inverted ? CGAffineTransformMake(1, 0, 0, -1, 0, 0) : CGAffineTransformIdentity;
}
Expand All @@ -575,6 +573,18 @@ - (void)setBounces:(BOOL)bounces
_textInputbar.bounces = bounces;
}

- (void)slk_updateInsetAdjustmentBehavior
{
// Deactivate automatic scrollView adjustment for inverted table view
if (@available(iOS 11.0, *)) {
if (self.isInverted) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
} else {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic;
}
}
}

- (BOOL)slk_updateKeyboardStatus:(SLKKeyboardStatus)status
{
// Skips if trying to update the same status
Expand Down