I have a UITableView that is a subview of my view controller. It sits on the bottom half of the screen and can be scrolled up using a gesture recognizer. When the gesture finishes, I call a UIView animation block to finish animating the UITableView by changing its top layout constraint (see example code below).
The animation itself works fine, but I noticed a strange side effect that the UITableViewCell subviews are exhibiting (check out the video - notice the bounce on the bottom-most cell of the table view), seemingly due to the layoutIfNeeded animation call.
Is there any way to isolate the layoutIfNeeded call to just the table view and not its subviews?
Code:
- (void) handlePanRecognizer:(UIPanGestureRecognizer*)recognizer {
if (recognizer.state == UIGestureRecognizerStateEnded) {
self.topLayoutConstraint.constant = 0.0f;
//Animate
[UIView animateWithDuration:kAnimationDuration
delay:0.0F
usingSpringWithDamping:kAnimationBounce
initialSpringVelocity:kAnimationBounce
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
[self layoutIfNeeded];
} completion:^(BOOL finished) {
}];
}
}
Video: