2014-01-14 95 views
1

我正在为我的应用程序使用iOS 7。在我的应用程序中,我将键盘外观更改为'UIkeyboardApperanceAlert'。它使键盘变黑。但问题是,当应用程序从背景到前景,每当我点击textField它首先打开白色的键盘,然后它的颜色变成黑色。ios 7键盘问题

为什么会发生这种情况?任何帮助表示赞赏,请回复。

+1

请与我们分享一些代码 – nivritgupta

+0

您好,感谢的答复, textField.keyboardAppearance = UIKeyboardAppearanceAlert;这是我用来更改键盘颜色的代码。 – nikBhosale

+0

重复此:http://stackoverflow.com/questions/19258765/ios-7-keyboard-color-flash这是一个在iOS 7中的错误,我对苹果开发论坛的反馈 – Woodstock

回答

1

我发现autocorrectionType属性设置为UITextAutocorrectionTypeNo解决了这个问题!

self.myTextField.autocorrectionType = UITextAutocorrectionTypeNo; 
0

UIKeyboardAppearanceAlert在ios7中已弃用。改用UIKeyboardAppearanceDark。

+0

hi.thanks很快回复,但UIKeyboardAppearanceAlert不被弃用,并根据你的建议,我已经尝试了黑暗,但它仍然是从白色变为黑色时,应用程序从背景到前景第一次。 – nikBhosale

+0

这是depreciated.open UITextInputTraits苹果文档,并参见UIKeyboardAppearance.https://developer.apple.com/library/ios/documentation/uikit/reference/UITextInputTraits_Protocol/Reference/UITextInputTraits.html – santhu

+0

您好santhu检查上面的链接,I错了。但即使现在我使用uiKeyboardAppearanceDark它仍然会给出同样的问题 – nikBhosale

-1

试试这个:

  1. 声明文本框在小时。文件。
  2. 在您的viewDidLoad/viewDidAppear添加这个(分配和ofcourse初始化后):

    [(的UITextField *)yourSubView setKeyboardAppearance:UIKeyboardAppearanceAlert]。

或者

[yourTextField setKeyboardAppearance:UIKeyboardAppearanceAlert];

+0

嘿乔尝试了你的建议,但没有成功。它只发生在应用程序从后台到前台以及第一次时。 – nikBhosale