Colored substring in UITextField
问题 I would like to change the color only of particular substrings (keywords) while the user is typing in a UITextField . In the documentation I saw the property textColor but it does change the color of the entire text string, while I would like to highlight only some keywords. Is it possible? 回答1: The short answer is no. It's possible if you create your own textfield from scratch using NSAttributedStrings and CATextLayers or Core Text, but this is an incredibly complex and difficult problem.