I am using autolayout with this layout:
self.view with frame (0,80, 320, 488)
collectionView with frame (0,0,320,220)
underView with frame (0,220,320,268)
and trying to achieve an animation which should resize underView enlarging its height such that underView partially covers collectionView moving bottom-up.
Autolayout forces an height constraint for those 2 views hence I have created an IBOutlet for underView height constraint which I am tweaking in animation:
NSLog(@"underView height %.2f", self.underView.frame.size.height);
NSLog(@"offset (%.2f, %.2f)", offset.x, offset.y);
heightConstraint.constant += offset.y;
NSLog(@"heightConstraint %.2f", heightConstraint.constant);
[self.underView setNeedsUpdateConstraints];
[UIView animateWithDuration:ANIMATION_DURATION
delay:ANIMATION_DELAY
options:UIViewAnimationOptionCurveEaseOut
animations:^{
[self.underView layoutIfNeeded];
NSLog(@"underView height %.2f", heightConstraint.constant);
} completion:nil];
And in the console I can see:
2013-07-30 09:09:37.268 Cal[49611:a0b] underView height 268.00
2013-07-30 09:09:37.268 Cal[49611:a0b] offset (320.00, 144.00)
2013-07-30 09:09:37.269 Cal[49611:a0b] heightConstraint 412.00
2013-07-30 09:09:37.270 Cal[49611:a0b] underView height 412.00
But the resize does not happen at all.
The only reason for this behavior I can think of is the height constraint of the collectionView above, but since I do not want the collection to reload I can not operate on that.
I am wondering how to achieve having the underView enlarging OVER the collectionView? I tried using constraint priorities but it didn't work...