UITableView frameshift animation problem

I knew a lot about this problem, but there seems to be no answer. Therefore, I hope that some of you may know how to deal with this. I have a view controller that has a table view, when I change the frame of the view using animation, everything goes well, except for one specific case where the tableview has more elements than it can fit on the screen, and only when the table scrolls down. Then, if I reduce the height of the view, my view will animate correctly, but the tableview somehow bounces a bit and only then animates from the bottom.

If I reduce the view, but the tableview does not scroll down (even if I can see the last cell, say a little more than half of it), it performs the animation correctly.

I tried a couple of things, such as turning masks on and off, as well as animating from the current state or something like that, but that didn't help: /

So, any suggestions, what could be the problem?

EDIT:

The code I use to change the frame

[UIView animateWithDuration:0.5
                          delay:0.0
                        options: UIViewAnimationCurveEaseOut
                     animations:^{

                         [_contView setFrame:CGRectMake(0, 0, 320, 420)];
                     } 
                     completion:^(BOOL finished){

                     }];
+5
source share
4 answers

I had a similar problem, and I implemented this workaround (Disclaimer: This is to crack the currently unresolved iOS error):

// check if the table view is scrolled to the bottom
if (tableView.contentOffset.y + tableView.frame.size.height == tableView.contentSize.height) {
    // if it is, shift the table view contents up one pixel
    [tableView setContentOffset:CGPointMake(tableView.contentOffset.x, tableView.contentOffset.y - 1) animated:NO];
}

// call the animation block afterwards here

, , 1 . UITableView ( Apple , ), .

+1

, , , ... .

: http://lists.apple.com/archives/cocoa-dev/2012/Apr/msg00341.html

, contentInset . , (, ) contentInset.bottom. .

:

UIEdgeInsets insets = myTable.contentInset;
insets.bottom += 50;   // 50px is the height of the ad banner view
myTable.contentInset = insets;
+2

xib, xcode... , . enter image description here

0

.

0

All Articles