Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Keyboard plugin question

$
0
0

Sure. About time someone else looks into getting this functionality working haha :wink:

After uncommenting the code from Ionic (which should allow you to change the keyboard between light/dark at any time) and finding it didn't work, I tried the following:

This was in the AppDelegate.h
@implementation UIWebBrowserView (KeyboardSwitch)
- (UIKeyboardAppearance) keyboardAppearance{
return UIKeyboardAppearanceDark;
}
@end

If iOS wasn't being retarded then that should just force it dark all the time; unfortunately the problem arises where sometimes the keyboard's color varies and is not always "dark appearance" by Apple.

I then tried many vastly different variations; all of which failed in one way or another (with the aforementioned iOS bug) until adding this to the IonicKeyboard.m worked:
- (void)formKeyboardWillShow:(NSNotification*)notif
{
UIWindow *keyboardWindow = nil;
for (UIWindow *windows in [[UIApplication sharedApplication] windows]) {
if (![[windows class] isEqual:[UIWindow class]]) {
keyboardWindow = windows;
break;
}
}
for (UIView* peripheralView in [self getKeyboardViews:keyboardWindow]) {
[[peripheralView layer] setBackgroundColor: [UIColor colorWithRed:0.2green:0.2 blue:0.2 alpha:1].CGColor];
}
}

Applying both of the code above was then working perfectly in iOS8; but broken again in iOS9. I would say this is somewhat to be expected as it changes the background color of some of the keyboard layers directly. This was done with a pretty perfect match to the correct dark keyboard appearance; but realistically would likely fail Apple app store guidelines (if they spotted it).

When iOS9 was released I tried for several more hours to manipulate the new layer structure and apply the same fix; but everything I tried ended up failing for one reason or another.

Best of luck with it; but really Apple should just fix the bug tbh


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>