【发布时间】:2024-01-06 01:56:01
【问题描述】:
我想突出显示 textview 中出现的每个单词。我认为我想要一个无限循环,因为我希望它始终扫描关键字的条目文本。我正在学习可能并非如此。我在寻找什么样的循环来实现连续扫描文本的目标?
while (range.location == textView.text.characters.count) {
text.addAttribute(NSForegroundColorAttributeName, value:UIColor.redColor(), range: nsString.rangeOfString("red"))
text.addAttribute(NSForegroundColorAttributeName, value: UIColor.redColor(), range: NSMakeRange(0, stringLength))
}
【问题讨论】:
标签: ios objective-c swift swift2