ios - UITableViewCell 中的标记

标签 ios uitableview uilabel token core-text

我想在我的 UITableViewCell 中重新创建这个标记。如果它使用 Regex 在 cell.textLabel.text 字符串中检测到带有 @ 的内容,我希望它是这样。它会自动使用如下所示的标记突出显示。

它也应该是可点击的。

I want to create something like this!

最佳答案

使用 CoreText 确定边界框,然后在绘制单元格 View 时使用该信息。

关于ios - UITableViewCell 中的标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12320855/

相关文章:

swift - 在 swift 中使用多个原型(prototype)单元只有在其中一个单元被停用时才有效

ios - 在 UITableView 中为原型(prototype)单元格添加边距

ios - UILabel textRectForBounds 不工作

iphone - 如何向 IBOutletCollection 添加对象?

ios - CAGradientLayer 使用 UIScrollView 滚动

iphone - iOS 应用分发问题

ios - 在 Swift 中获取和设置 UITextField 和 UITextView 的光标位置

ios - UIPickerView 作为多个 UITextField 的 inputView

iphone - 如何缓存表格 View 的某些内容?

ios - 平衡多行 UILabel