问题描述
我正在使用UITextView并启用分页(在IB中并以编程方式打开和关闭它).文本很多,在启用分页功能的情况下滚动时,当前可查看文本的第一行和/或最后一行有时会在框架的底部或顶部出现在视图的一半,而在视图的一半处不在视图的一半,因此您只能看到顶部或底部该文本行的下半部分. (希望我能正确解释)
I am using a UITextView and enabling paging (in both IB and programatically toggling it on and off). There's a lot of text and when scrolling with paging enabled sometimes the first and/or last line of the currently viewable text ends up halfway in view and half out of view at the bottom or top of the frame so you can only see the top or bottom half of that line of text. (I hope I'm explaining that correctly)
有人知道一种确保页面正确分页的方法吗,这样就不会半截文本行?
Does anyone know a way to insure that it pages correctly so it there's no lines of text half cut off??
一些注意事项1.字体大小可由用户调整.2.我已经尝试过setContentOffset,setContentInset,setContentSize,但它并没有帮助(除非我错误地使用了它们)3.我正在使用txt文件填充UITextView
A few notes1. The font size is adjustable by the user.2. I've tried setContentOffset,setContentInset,setContentSize and it's not helping (unless I'm using them wrong)3. I am using a txt file to populate the UITextView
提前谢谢!
推荐答案
UITextView
是UIScrollView
的子类.因此,我不相信UITextView
实际上支持分页,因为这是UIScrollView
的功能.您能否退后一步并解释最终目标,因为听起来像是将NSString
渲染到UIScrollView
中实际上是您想要的,而不是UITextView
.
UITextView
is a subclass of UIScrollView
. As such I do not believe UITextView
actually supports paging as this is a feature of UIScrollView
. Can you please take a step back and explain the end goal, as it sounds like rendering an NSString
in to a UIScrollView
might be actually what you want, instead of a UITextView
.
这篇关于UITextView分页已启用文本已截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!