With iOS7, the protocol UITextInputTraits
gets new values for the enum UIKeyboardAppearance
.
In particular I'm interested in changing the keyboardAppearance
to UIKeyboardAppearanceDark
in order to match the current app dark design.
I first looked into the Info.plist but it seems that there isn't a key in that allows you to globally set this property.
My second thought was to use the UIAppearance but unfortunately the keyboardAppearance
doesn't have the UI_APPEARANCE_SELECTOR
decorator.
But for some reason this code:
[[UITextField appearance] setKeyboardAppearance:UIKeyboardAppearanceDark];
works on iOS7, but crashes in iOS6.
Even more strangely the following code:
[[UITextView appearance] setKeyboardAppearance:UIKeyboardAppearanceDark];
doesn't work in iOS7 nor iOS6.
A good idea can be to create a subclass of both UITextField & UITextView but in this way this doesn't work for example in UISearchBar.
I don't want to create a category because I don't want to sort-of-override the implementation of Apple classes and probably not been future proof.
Any one have ever dealt with this?
Go to Settings > Accessibility > Keyboards, tap Full Keyboard Access, then turn on Full Keyboard Access.
Use this control https://github.com/hackiftekhar/IQKeyboardManager
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[IQKeyboardManager sharedManager] setOverrideKeyboardAppearance:YES];
[[IQKeyboardManager sharedManager] setKeyboardAppearance:UIKeyboardAppearanceDark];
return YES;
}
It is mainly used to manage the distance between keyboard & textField but your issue can also be resolved via this great library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With