iOS:如何将可滚动文本视图添加到应用程序首选项?
我需要将可滚动文本视图添加到我的应用程序首选项中,例如苹果自己的法律页面(查看“设置”->“常规”->“关于”->“法律”)。我该怎么做?
I need to add scrollable text view to my application preferences, like Apple's own legal page (look at Settings->General->About->Legal). How do I do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我找到了一个可以完成这项工作的解决方法。将需要显示的长文本拆分为一组或多个段落,每个不超过 500 字节(我不确定确切的数字,但如果 PSGroupSpecifier 中的标题文本太长,iOS 将不会显示任何内容)。然后为每个段落创建具有单独 PSGroupSpecifier 元素的 Legal.plist:
然后将其显示为子窗格。宾果游戏 - 你有一个文本滚动条!
I found a workaround which does the job. Split long text you need to display into a set or paragraphs, each no longer than 500 bytes (I'm not sure about exact number, but if Title text in PSGroupSpecifier is too long, iOS won't display anything). Then create Legal.plist with separate PSGroupSpecifier element for each paragraph:
and then show it as a child pane. Bingo - you have a text scroller!
使用 PSGroupSpecifier,将所需的文本设置为标题。
请注意,您可以拥有的文本量是有限的,因此您需要使用多个组说明符。
(据我所知,每组的限制是 500 个字符)
Use a PSGroupSpecifier, setting the text you need as Title.
Observe that there is a limit to the amount of text you can have so you would need to use multiple group specifiers.
(as far as I can see, the limit is in the region of 500 chars per group)
您的一种选择是使用
UITextView
:
如果要显示富文本,可以通过将自己的 HTML(存储为资源文件)加载到
UIWebView
。One option you have is using
UITextView
:If you want to display a rich text, you can do that by loading your own HTML (stored as a resource file) into a
UIWebView
.