Last active
August 15, 2016 16:11
-
-
Save hudinwal/35b5afd6505fe9819882e0685d8b5298 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
var topOffset: CGFloat = 0.0 | |
private let kTopWindowAspectRatio : CGFloat = 3.0/4.0 | |
override func viewDidLayoutSubviews() { | |
super.viewDidLayoutSubviews() | |
// Calculate the top offset and set it if not corectly set | |
if(topOffset != CGRectGetWidth(pullDownTableView.bounds) * kTopWindowAspectRatio) { | |
topOffset = CGRectGetWidth(pullDownTableView.bounds) * kTopWindowAspectRatio | |
// Setup table view insets and offsets | |
let topInset = CGRectGetHeight(pullDownTableView.bounds) | |
pullDownTableView.contentInset = UIEdgeInsetsMake(topInset, 0, 0, 0); | |
pullDownTableView.contentOffset = CGPointMake(0, -topOffset) | |
// Align the moveable image view center | |
moveableImageView.center = view.center | |
moveableImageView.center.y = topOffset/2 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment