Last active
August 29, 2015 14:12
Auto Layout and UIScrollView Tutorial
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
// -- animate the placements of our auto layout constraints -- // | |
// Place the scroll view slightly offset from center before animating // | |
self.view.layoutIfNeeded() | |
self.asvScrollView.center = CGPointMake(CGRectGetMidX(self.view.frame), CGRectGetHeight(self.view.frame)/8.0) | |
UIView.animateWithDuration(1.75, animations: { () -> Void in | |
// apply custom constraints to our scroll view // | |
self.asvApplyHeightAndWidthConstraints() | |
self.asvApplyCenteringConstraints() | |
self.view.layoutIfNeeded() | |
}) { (animated) -> Void in | |
// -- animation completion block -- // | |
// Once the initial animation is complete we animate the // | |
// contents of the scroll view by changing its content offset. // | |
self.asvScrollView.setContentOffset(CGPointMake(CGRectGetMaxX(self.asvLeftView.frame), 0), animated: true) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment