解决做Mansonry/Autolayout动画时,uitextfield中的文字会向上抖动或跳动的问题
来源:互联网 发布:西工大矩阵论课件 编辑:程序博客网 时间:2024/06/04 18:44
今天用了Masonry做了一个动画,动画的时候发生了一个奇怪的现象
居然画面中所有的UITextfield在切换焦点的里面文字都向上抖动一下或者说是跳动一下。醉醉的 ,后来改了一行代码就好了初始代码如下
+(BOOL)requiresConstraintBasedLayout{ return YES;}-(void)updateConstraints{ [self.imgCompanyIcon mas_updateConstraints:^(MASConstraintMaker *make) { make.centerX .equalTo(self.mas_centerX); make.width.equalTo(@90); make.height.equalTo(@90); make.top.equalTo(self.mas_top).with.offset(86 -180*self.isKeybordShow); }]; [super updateConstraints];}#pragma mark - Keyboard Notification-(void)keyboardWillShow:(NSNotification *)notifi{ NSDictionary* userInfo = [notifi userInfo]; NSValue* animationDurationValue = [userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey]; NSTimeInterval animationDuration; [animationDurationValue getValue:&animationDuration]; self.isKeybordShow = YES; [self setNeedsUpdateConstraints]; [self updateConstraintsIfNeeded]; [UIView animateWithDuration:animationDuration animations:^{ [self layoutIfNeeded]; }];}
最后发现只要将最后一句[self layoutIfNeeded];改为[self layoutSubviews];就好了
2 0
- 解决做Mansonry/Autolayout动画时,uitextfield中的文字会向上抖动或跳动的问题
- js向上滚动文字问题的解决
- UITextField抖动动画
- UITextField抖动动画
- UITextField 解决限制文字长度不准确的问题
- 跳动的文字
- 跳动的文字
- UITextField的左右图片,内容位置调整,解决输入框输入时上下抖动
- 会跳动的图片
- 会跳动的心
- 会跳动的日历
- ScrollView抖动问题的解决
- 上下跳动的动画
- unity3d 动作会产生抖动的问题
- unity3d 动画抖动解决
- 动画抖动 解决
- iOS解决navigationBar因为图片尺寸问题造成的会向上偏移64的问题
- 导入Unity的模型在播放动画时手脚会轻微晃动(抖动)
- QML中的SequentialAnimation队列动画
- ASP.Net WebService服务启动不了,显示下面错误
- stm32 外部中断的使用(含实例)
- 给C++初学者的50个忠告
- 怎么查看.ipa的内容
- 解决做Mansonry/Autolayout动画时,uitextfield中的文字会向上抖动或跳动的问题
- 引用
- C# 委托做法
- html5的离线缓存
- Linux与Win之间传输文件
- 角秒是什么单位?
- aconfigure: error: no acceptable C compiler found in $PATH
- HTML5 - 最简单的html5网页格式样例
- 在windows7系统中显示和隐藏系统保留盘