美文网首页
iOS 使用masonry 添加动画

iOS 使用masonry 添加动画

作者: 水灵芳蕥 | 来源:发表于2019-11-27 14:28 被阅读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];   //一定要加,---父视图---  刷新

        }];

相关文章

网友评论

      本文标题:iOS 使用masonry 添加动画

      本文链接:https://www.haomeiwen.com/subject/bmypwctx.html