Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 使用autolayout通过动画更改tableview帧_Ios_Objective C_Uitableview_Autolayout - Fatal编程技术网

Ios 使用autolayout通过动画更改tableview帧

Ios 使用autolayout通过动画更改tableview帧,ios,objective-c,uitableview,autolayout,Ios,Objective C,Uitableview,Autolayout,我试图通过在animationWithDuration块中使用自动布局来更改tableview帧。这样, [UIView animateWithDuration:0.3f animations:^{ weekdayOffersVerticalConstraint.constant = 80; [headerView layoutIfNeeded]; [weekdayTableView layoutIfNeeded];

我试图通过在animationWithDuration块中使用自动布局来更改tableview帧。这样,

[UIView animateWithDuration:0.3f animations:^{

            weekdayOffersVerticalConstraint.constant = 80;
            [headerView layoutIfNeeded];
            [weekdayTableView layoutIfNeeded];

            self.isTableViewSmall = YES;

        } completion:^(BOOL finished) {


        }];
我的tableview的帧随着这个代码块的变化而变化,但当我向下滚动时,单元格从左侧到右侧,我认为这与
[weekdayTableView LayoutFneed]有关布局需要对所有子视图产生效果。如何阻止对tableview单元格的影响


很抱歉我的英语不好,非常感谢您的回答和建议。

在开始动画更新约束之前,请致电
layoutifneed

[headerView layoutIfNeeded];
[weekdayTableView layoutIfNeeded];
[UIView animateWithDuration:0.3f animations:^{

            weekdayOffersVerticalConstraint.constant = 80;
            [headerView layoutIfNeeded];
            [weekdayTableView layoutIfNeeded];

            self.isTableViewSmall = YES;

        } completion:^(BOOL finished) {
            //
        }];
您可能也不希望在动画块内设置该
BOOL
属性,除非您有一个方法在动画期间有意覆盖该属性