Animating layoutIfNeeded on UITableView without animating UITableViewCells

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?


- (void) handlePanRecognizer:(UIPanGestureRecognizer*)recognizer {
  if (recognizer.state == UIGestureRecognizerStateEnded) {
    self.topLayoutConstraint.constant = 0.0f;

  [UIView animateWithDuration:kAnimationDuration
                     [self layoutIfNeeded];
                   } completion:^(BOOL finished) {




The problem ended up having to do with auto layout constraints.

I had set a bottom constraint to my table view so its initialized height was much smaller than its full screen height. When animating the top layout constraint, it would stretch the table view to the correct size, but auto layout was interpolating subview constraints (such as those in my table view cell contentView) weirdly.

The solution was to remove the bottom layout constraint from the table view and instead give it an equal height constraint to the view.

Need Your Help

Resizing Windows of Unscriptable Applications in AppleScript

cocoa osx resize window applescript

I am working on an application that moves and resizes windows of other applications on OSX.

ptrace one thread from another

multithreading ptrace

Experimenting with the ptrace() system call, I am trying to trace another thread of the same process. According to the man page, both the tracer and the tracee are specific threads (not processes),...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.