繁体   English   中英

tableView.beginUpdates无法正常运行iOS10

[英]tableView.beginUpdates is not working iOS10

在我的应用程序中,我使用tableview.begingUpdates()来动画化tableviewcell高度的变化(图像的扩展和碰撞)。 它在iOS 8.0-9.3上运行良好。 在iOS10.0之后,它由于未知原因停止工作。 现在有人面对这个问题吗?

#pragma mark - Table view delegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return self.selectedIndexPath && self.selectedIndexPath.row == indexPath.row ? self.view.frame.size.height - self.navigationController.navigationBar.frame.size.height + 20 : UITableViewAutomaticDimension;
}

在didSelect方法内部

if(shouldExpand){
        [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
            [self.tableView beginUpdates];
            [self.tableView endUpdates];
        } completion:nil];
}
else{
    [self.tableView beginUpdates];
    [self.tableView endUpdates];
}

我发现在iOS10.0中,对于超级视图的约束的更改对于子视图的约束几乎是一团糟。 向Apple提交了错误,并等待答案。 已举报,这是一个链接

我遇到过同样的问题。 我所做的是在调用.endUpdate()方法(我有一个委托方法,在发生这种情况时会通知我)之后调用tableView.reloadData() (因为单元格已经存在)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM