UITextView does not save markTextStyle (UITextInput protocol)

Marking the text in a UITextView, but for some reason it refuses to accept anything that I give it using setMarkedTextStyle. -markedTextStyle always returns nil, and the selected text always looks the same (blue background and supports the color of the text).

[_taggedUsersView setMarkedTextStyle:@{UITextInputTextColorKey: [UIColor whiteColor], UITextInputTextBackgroundColorKey: [UIColor tranceLinkBlue], UITextInputTextFontKey: [UIFont fontWithName:@"HelveticaNeue-Medium" size:14.0]}]; 

I tried to do this when I create a text view, right before marking the text and immediately after. But it still maintains the default style and returns zero for the style.

+6
source share
3 answers

After many tests, the only thing I can say is that this is a bug in the SDK. The markedTextStyle property has no effect, and getter always returns nil.

This contradicts what we can read in the documentation:

markedTextStyle

An attribute dictionary that describes how marked text should be drawn.

I reported this to Apple as an error (Bug ID - 17914881 ).

+1
source
0
source

Do you want to change the selectedText or markedText ?

Later it will only be for Chinese / Japanese letters, so maybe you should try changing highlightedTextColor .

0
source

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


All Articles