700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > android textview 动态高度自适应 TextView自适应高度(解决_UITextContainerView布局问题)...

android textview 动态高度自适应 TextView自适应高度(解决_UITextContainerView布局问题)...

时间:2021-09-11 13:33:51

相关推荐

android textview 动态高度自适应 TextView自适应高度(解决_UITextContainerView布局问题)...

对于自定义创建回复框, textView自适应高度, 根据textView.contentSize.height调节高度时, 有时候会有textView换行时文字跳动过高, 不是平滑过渡.

请参考一下代码:[textView scrollRangeToVisible:NSMakeRange(0, 0)]; 能有效避免自适应高度时文字跳动不符的情况.

-(void)textViewDidChange:(UITextView *)textView{

NSInteger wordCount = textView.text.length;

self.textView.countNum = wordCount;

CGFloat height = textView_height;

if (textView.contentSize.height < 150) {

if (textView.contentSize.height > 30) {

height = 85 + textView.contentSize.height;

}else{

height = textView_height;

}

self.textView.y = KScreenHeight - self.keybordHeight - height;

self.textView.h = height;

[textView scrollRangeToVisible:NSMakeRange(0, 0)];

}

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。