美文网首页iOS
Masonry动画更新约束

Masonry动画更新约束

作者: ZhangYanSong | 来源:发表于2017-11-23 10:20 被阅读101次

    [self.view addSubview:siftView];

    // siftView中含有子view, 此时在屏幕外

    [siftView mas_makeConstraints:^(MASConstraintMaker *make) {

    make.top.mas_equalTo(weakSelf.view.mas_top);

    make.left.mas_equalTo(weakSelf.view.mas_left);

    make.bottom.mas_equalTo(weakSelf.view.mas_bottom);

    make.right.mas_equalTo(weakSelf.view.mas_right);

    }];

    // 动画开始前强制刷新

    [siftView layoutIfNeeded];

    // 更新约束

    [siftView.siftView mas_updateConstraints:^(MASConstraintMaker *make) {

    make.right.mas_equalTo(siftView.mas_right);

    }];

    // 在UIView的动画中调用强制刷新产生动画效果

    [UIView animateWithDuration:0.2 animations:^{

    [siftView layoutIfNeeded];

    }];

    相关文章

      网友评论

        本文标题:Masonry动画更新约束

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