How to change the color of the iOS autocorrect suggestion?

后端 未结 1 1661
野性不改
野性不改 2021-01-02 07:34

After much searching here and on the web and in developer forums, I can\'t believe that nobody seems to have even asked this question before.

The iOS autocorrect sug

1条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-02 07:57

    The UITextInput protocol defines a method - (NSDictionary *)textStylingAtPosition:(UITextPosition *)position inDirection:(UITextStorageDirection)direction which the docs claim can be used to style correction rectangles. I gather this would be communicated through a UITextPosition subclass that indicates styling information is being requested, but I'm not sure on the details of that. Something to look more into for sure!

    EDIT:

    I just implemented a UITextField and a UITextView subclass and overrode the below method. The method was never called :( Sorry to answer with false hope!

    EDIT 2: found a blog post explaining why it was never called: http://bjhomer.blogspot.com/2011/11/detecting-backspace-in-uitextfield.html

    0 讨论(0)
提交回复
热议问题