Skip to content

Instantly share code, notes, and snippets.

@gimenete
Created August 31, 2016 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gimenete/2202379d4c3629738372a287b0d4abb3 to your computer and use it in GitHub Desktop.
Save gimenete/2202379d4c3629738372a287b0d4abb3 to your computer and use it in GitHub Desktop.
func layoutFloatingView() {
let width = CGRectGetWidth(tableView.frame)
let y = tableView.contentOffset.y + (tableView.tableHeaderView == nil ? 0 : CGRectGetHeight(tableView.tableHeaderView!.frame)) + 64
floatingView.frame = CGRectMake(0, y, width, 65)
tableView.bringSubviewToFront(floatingView)
}
override func scrollViewDidScroll(scrollView: UIScrollView) {
layoutFloatingView()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment