iOS如何给约束加动画?

iOS中,一般这样加动画:

[UIView animateWithDuration:interval animations:^{

        if (showBlock) {

            showBlock(keyboardHeight);

        }

    }];

   }];

但是,如果是给约束值constant加动画的话就不行了。

解决方法:

加一句话:

[self.view layoutIfNeeded];


猜你喜欢

转载自blog.csdn.net/u011189158/article/details/50932698