Created
October 19, 2015 11:17
-
-
Save max-potapov/4ffe78c7ee61063b4ef4 to your computer and use it in GitHub Desktop.
This file contains 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
extension UIViewController { | |
func adjustTableViewInsects(tableView: UITableView?) { | |
guard let tableView = tableView, let navigationController = navigationController else { | |
return | |
} | |
automaticallyAdjustsScrollViewInsets = false | |
let statusBarHeight = UIApplication.sharedApplication().statusBarFrame.size.height | |
let navigationBarHeight = navigationController.navigationBar.bounds.size.height | |
tableView.contentInset.top = statusBarHeight + navigationBarHeight | |
tableView.scrollIndicatorInsets = tableView.contentInset | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment