Objective-C:如何实现TextView孤儿控件
我正在开发一款 iPad 应用程序,它可以像 iBooks 一样简单地显示文本。
我想在每个屏幕上仅显示完整段落(即页面上没有孤儿/寡妇)。与 iBooks 类似,我希望允许用户更改字体和字体大小,并继续将段落中的所有行保留在一起。用户将能够向前和向后翻页(就像 iBooks 一样)。
我一直在研究这个问题,但找不到解决方案。我认为有人已经完成了这段代码,但看起来我必须计算出字体的磅值并计算 TextView 的大小,然后计算有多少个字符等
。有建议我可以从哪里开始这样做吗?
非常感谢!
I'm working on an iPad app that does a simple display of text similar to iBooks.
I would like to display ONLY full paragraphs on each screen (ie, no orphan/widows on a page). Similar to iBooks, I want to allow the user to change the font and font size and continue to keep all lines in paragraphs together. The user will be able to page forward and backwards (just like iBooks).
I've been researching this and can't find a solution for this. I would think that someone has already done this code, but it looks like I'm going to have to figure out the point size of the font and calculate the size of the TextView and then count how many characters, etc etc etc.
Does anyone have a suggestion where I might start to do this?
Thanks a bunch!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 NSString UIKit 添加它具有计算给定字体中字符串的渲染将占用多少空间的方法。
Look at the NSString UIKit Addition it has methods for calculating how much space the rendering of string in a give font will take.