How to change the font color of individual characters in a UIPickerView string?

I have an application that displays text in a search-based UIPickerView. I want to highlight specific letters in a string that are the result of a wildcard.

For example, if I searched for “CA?”, “CAT” will be displayed in one of the lines, and I want the letter “T” to be in blue.

Any ideas? The user receives immediate feedback as he types, so performance is important.

+3
source share
2 answers

Thanks to David for the tip to get me started.

Three20 TTStyledTextLabel pickerView: viewForRow: forComponent: reusingView: , [TTStyledText textFromXHTML: myXHTML] TTDefaultStyleSheet, . UIPickerView.

+1

, , NSAttributedString. UIPickerView, -, NSAttributedString -, UILabel, , . , UIView pickerView:viewForRow:forComponent:reusingView: UIPickerViewDelegate.

+1

Source: https://habr.com/ru/post/1758488/


All Articles