Question

First I'm so newb to iPhone dev and I'm sorry if this is easy.

Is it possible to change the amount of transparency on the iPhone keyboard (or even the color if that's possible).

I know you can acquire a reference to the keyboard view (link provided) http://www.iphonedevsdk.com/forum/iphone-sdk-tutorials/7350-adding-subviews-custimize-keyboard.html

I found this stackoverflow post which leads me to believe it could be done through an animation. iPhone UIView Animation Best Practice

but I have no idea where I would put this code.

Thanks for any thoughts and comments. Everything friendly is appreciated :)

-TK

Thanks for the comments guys. I don't care if it passes the app store though. Just want to try and do it. Thanks again :)

Was it helpful?

Solution

There's only two styles available in the public API:

[textView setKeyboardAppearance:UIKeyboardAppearanceAlert];
[textView setKeyboardAppearance:UIKeyboardAppearanceDefault];

But you can use private API methods to retrieve the keyboard implementation:

id keyboardImpl = [objc_getClass("UIKeyboardImpl") sharedInstance];

And Make it less opaque,

[keyboardImpl setAlpha:0.8f];

Tint it,

UIView *tint = [[UIView alloc] initWithFrame:[keyboardImpl frame]];
[tint setBackgroundColor:[UIColor colorWithRed:0.0f green:0.0f blue:1.0f alpha:0.3f]];
[tint setUserInteractionEnabled:NO];
[[keyboardImpl superview] insertSubview:tint aboveSubview:keyboardImpl];
[tint release];

Or even flip it:

[[keyboardImpl window] setTransform:CGAffineTransformMakeScale(-1.0f, 1.0f)];

but all will prevent your app from being approved

OTHER TIPS

If you can do it, Apple will reject your app because you're hacking into objects that are part of the operating system (not saying I agree with this, but Apple is very particular about people changing the look of their UI).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top