I have three views like so:
The grey view has a top constraint to "Header 1" and "Header 2" has a top constraint to the grey view.
I am animating the grey view like this:
CGRect rect = self.fruitSection.frame;
rect.size.height = 0;
[UIView animateWithDuration:0.3 animations:^{
[self.greySection setFrame:rect];
}];
And this makes it slide up. However, when the grey view slides to height=0, the "Header 1" view below it stays where it is (and leaves whitespace between "Header 1" and "Header 2" where the grey view used to be).
Is there a way I can make "Header 2" slide up as the grey view collapses?
Thanks!
UPDATE
I've tried to animate the constraint instead of the actual view like so:
[UIView animateWithDuration:0.5 animations:^{
self.greyHeightConstraint.constant = 0.0f;
}];
and this works, but the view isn't animated; it "jumps" instead of slides