美文网首页
iOS UITextField取消第一响应时文字会跳动

iOS UITextField取消第一响应时文字会跳动

作者: Accepted_ | 来源:发表于2017-04-13 12:12 被阅读0次

    使用Masonry布局。然后使用mas_update更新约束做了一个动画。更新约束部分代码如下(在监听键盘弹出的方法里)

    [self.myView mas_updateConstraints:^(MASConstraintMaker*make) {

            make.width.height.mas_equalTo(10);//size变小

    }];

    [UIView animateWithDuration:.3 animations:^{

            [self.view layoutIfNeeded];

    }];

    修正 bug:

    把最后一句[self.view layoutIfNeeded];改为[self.view layoutSubviews];,取消第一响应的时候文字就不会跳动了。

    [UIView animateWithDuration:.3 animations:^{

            [self.view layoutSubviews];

    }];

    相关文章

      网友评论

          本文标题:iOS UITextField取消第一响应时文字会跳动

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