iPhone编程:在句子之间插入标签

发布于 2024-09-09 03:40:22 字数 168 浏览 4 评论 0原文

我有一个有趣的用户界面,其中表视图包含一些文本行。我需要突出显示每行中的某些单词,并且可以选择这些单词来呈现一些工具提示。

我想到为这些单词使用标签,这样我就可以突出显示它们并捕获任何触摸事件。但我找不到实现流程布局的方法。

有更好的方法来做到这一点吗?

预先感谢您的帮助!

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七色彩虹 2024-09-16 03:40:22

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文