如何更改iOS自动更正建议的颜色? [英] How to change the color of the iOS autocorrect suggestion?

查看:138
本文介绍了如何更改iOS自动更正建议的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

经过大量搜索,在网上和开发者论坛中搜索,我无法相信之前似乎没有人问过这个问题。

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.

iOS自动更正建议总是在白色背景上弹出蓝色字体,无论UITextField或UITextView或其他任何颜色如何。这有时看起来很糟糕,例如在黑暗的背景。它会采用您正在编辑的文本字体,但无法更改默认颜色,这似乎很奇怪。

The iOS autocorrect suggestions always popup with a blue font on a white background, regardless of the colors of your UITextField or UITextView or anything else. This looks pretty bad sometimes, e.g. on a dark background. It seems bizarre that it would adopt the font of the text you're editing, but have no way to change the default colors.

然而在内置的iOS中Notes应用程序,自动更正建议显示为黄色背景和红色字体。

And yet in the built-in iOS Notes app, the autocorrect suggestions appear beautifully with a yellow background and red font.

我错过了一些明显的东西吗?

Am I missing something obvious here?

推荐答案

UITextInput 协议定义了一个方法 - (NSDictionary *)textStylingAtPosition:(UITextPosition *)的位置inDirection:(UITextStorageDirection)方向文档声称可以用于样式校正矩形。我收集这将通过UITextPosition子类传达,该子类指示正在请求样式信息,但我不确定详细信息。有些东西值得肯定!

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!

编辑:

我刚刚实现了一个UITextField和一个UITextView子类,超越以下方法。该方法从未被调用:(抱歉以错误的希望回答!

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!

编辑2:发现一篇博客文章解释了为什么它从未被调用过: http://bjhomer.blogspot.com/2011/11/detecting-backspace-in-uitextfield。 html

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

这篇关于如何更改iOS自动更正建议的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆