When a user does some action, I need to pull a UICollectionView
from the bottom up to a certain height. Since that new state is totally optional, the collection
I've been in this problem for around 3 days and finally got a solution. Simply I added the animation block to be called after a very tiny timer
UIView.animateWithDuration(0.5, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 7 , options: .CurveEaseInOut, animations: {
self.view.layoutIfNeeded()
}){ _ in}
will be
let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(0.1 * Double(NSEC_PER_SEC)))
dispatch_after(delayTime, dispatch_get_main_queue()) {
self.changeConstraint()
}
private func changeConstraint(){
UIView.animateWithDuration(0.5, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 7 , options: .CurveEaseInOut, animations: {
self.view.layoutIfNeeded()
}){ _ in}
}
See the magic :)