美文网首页
textView 自动换行, 可以文本内容动态移动

textView 自动换行, 可以文本内容动态移动

作者: 王誌傑 | 来源:发表于2017-05-22 17:30 被阅读53次

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

//博客园-FlyElephant

staticCGFloatmaxHeight =95;

CGRectframe = textView.frame;

CGSizeconstraintSize =CGSizeMake(frame.size.width,MAXFLOAT);

CGSizesize = [textViewsizeThatFits:constraintSize];

if(size.height<=maxHeight) {

size.height=maxHeight;

}

textView.scrollEnabled=NO;//不允许滚动

textView.frame=CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, size.height);

}

相关文章

网友评论

      本文标题: textView 自动换行, 可以文本内容动态移动

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