iOS键盘颜色更改-keyboardAppearance深色不粘 [英] iOS Keyboard Colour Changes - keyboardAppearance dark color doesn't stick

查看:503
本文介绍了iOS键盘颜色更改-keyboardAppearance深色不粘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的应用中,我们将keyboardAppearance设置为暗。如预期的那样,这将产生一个黑色键盘。但是,如果显示了键盘,并且我们按下了主页按钮,然后返回到应用程序,则键盘变成白色,如图所示。知道为什么吗?

In our app, we set the keyboardAppearance to dark. This produces a black keyboard, as expected. However, if the keyboard is showing, and we press the home button, and then go back into the app, the keyboard turns white, as shown. Any ideas why?

推荐答案

它可能与键盘是全局对象这一事实有关。在任何给定时间内存中只有一个键盘。另外,操作系统将根据背景自动更改键盘颜色。因此,您的设置可能会被覆盖。我建议您在应用程序进入背景时隐藏键盘,然后在重新进入前景时重新显示键盘。然后,当您重新显示键盘时,通过代码重置键盘外观。

It may have todo with the fact that the keyboard is a global object. There's only ever one keyboard in memory at any given time. Also, the OS will automatically change the keyboard color based on the background. Therefore, your setting is probably just getting overridden. I would suggest hiding the keyboard when your app enters the background, and then re-show it when it re-enters the foreground. Then when you re-show the keyboard reset the keyboard appearance via code.

这篇关于iOS键盘颜色更改-keyboardAppearance深色不粘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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