iPhone编程:在句子之间插入标签
我有一个有趣的用户界面,其中表视图包含一些文本行。我需要突出显示每行中的某些单词,并且可以选择这些单词来呈现一些工具提示。
我想到为这些单词使用标签,这样我就可以突出显示它们并捕获任何触摸事件。但我找不到实现流程布局的方法。
有更好的方法来做到这一点吗?
预先感谢您的帮助!
I have an interesting UI where a table view contains some lines of text. There are certain words in each line that I need to highlight and those words can be selected to render some tooltip.
I thought of using labels for these words so I can highlight them and also capture any touch events. But I couldn't find a way of achieving a flow layout.
Is there a better approach to do this?
Thanks in advance for the help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
UIWebView 当然可以处理布局问题,但可能会导致其他性能问题,特别是如果您将其放入表视图中。
您还可以查看
NSString (UIStringDrawing)
方法,它们对于测量和绘制文本很有帮助。它们实际上非常强大,允许您指定大小限制和换行模式。A UIWebView would certainly handle the layout problem, but may cause other performance issues, especially if you're putting it in a table view.
You might also look at the
NSString (UIStringDrawing)
methods, which are helpful for measuring and drawing text. They're quite powerful actually, allowing you to specify size constraints and line break modes.