
CGFloat height = textView.contentSize.height - textView.frame.size.height+16.0f;
NSLog(@"height:%f",height);
CGRect frame = textView.frame;
frame.size.height = frame.size.height + height;
textView.frame = frame;
这样写为什么最后会多出一行空白
如果不加16.0f

则是字会被顶上去 求指教 谢谢
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
这个代码片段不足以看出问题在哪,textView建议你设置一个有颜色的背景,方便观察。
另外还有一个简单的办法实现你想要的功能
GrowingTextView: https://github.com/HansPinckaers/GrowingTextView加上这个self.textview.layoutManager.allowsNonContiguousLayout = NO;