UITableView框架更改动画问题

Luk*_*kas 5 iphone objective-c uitableview ios

我已经搜索了很多这个问题,但似乎没有答案.所以我希望你们中的一些人知道如何解决这个问题.我有一个具有tableview的视图控制器,当我用动画更改视图框架时,一切顺利,除了一个特殊情况,当tableview有更多的项目而不是它适合屏幕时,并且只有当tableview滚动到底部时.然后,如果我缩小视图高度,我的视图正确动画,但tableview以某种方式跳起来,然后动画到底部.

如果我收缩视图,但tableview没有滚动到底部(即使我可以看到最后一个单元格,让我们说它超过一半)它会正确地进行动画制作.

我已经尝试了几件事,比如开启和关闭自动调整遮罩,以及从当前状态或类似的东西设置动画,但这没有帮助:/

那么任何建议可能是什么问题?

编辑:

我用来改变框架的代码

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

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

                     }];
Run Code Online (Sandbox Code Playgroud)

Ant*_*ton 1

我曾经遇到过类似的问题,我实现了这个解决方法(免责声明:这是对当前未解决的 iOS 错误的破解):

// 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
Run Code Online (Sandbox Code Playgroud)

这是一种 hack,但用户不会注意到,因为它只是 1 像素的运动。当涉及从滚动到底部位置的动画时,UITableView 有一些错误(已向 Apple 报告,但尚未解决)。