iOS 使用masonry 添加动画

2019-11-27  本文已影响0人  水灵芳蕥

预先定义一个约束的全局变量,用来接收需要变化的约束

@property (nonatomic, strong) MASConstraint *bottomViewBottom;

[self.bottomViewBottom uninstall];

        [UIView animateWithDuration:0.3 animations:^{

            [self.bottomViewmas_updateConstraints:^(MASConstraintMaker*make) {

                self.bottomViewBottom= make.bottom.mas_equalTo(-300);

            }];

            [self.viewlayoutIfNeeded];   //一定要加,---父视图---  刷新

        }];

上一篇下一篇

猜你喜欢

热点阅读