Created
February 6, 2014 11:17
-
-
Save danielctull/8842328 to your computer and use it in GitHub Desktop.
Inset scrollviews
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)viewDidLayoutSubviews { | |
| [super viewDidLayoutSubviews]; | |
| [self modifyEdgeInsetsOfScrollView:self.tableView]; | |
| [self modifyEdgeInsetsOfScrollView:self.webView.scrollView]; | |
| } | |
| - (void)modifyEdgeInsetsOfScrollView:(UIScrollView *)scrollview { | |
| scrollview.contentInset = [self modifiedEdgeInsets:scrollview.contentInset]; | |
| scrollview.scrollIndicatorInsets = [self modifiedEdgeInsets:scrollview.scrollIndicatorInsets]; | |
| } | |
| - (UIEdgeInsets)modifiedEdgeInsets:(UIEdgeInsets)edgeInsets { | |
| UIEdgeInsets modifiedInsets = edgeInsets; | |
| modifiedInsets.top = self.topLayoutGuide.length; | |
| modifiedInsets.bottom = self.bottomLayoutGuide.length; | |
| return modifiedInsets; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment