Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Iphone Keyboard Transparency

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 :)

like image 870
TEEKAY Avatar asked Jun 23 '09 15:06

TEEKAY


1 Answers

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

like image 185
rpetrich Avatar answered Sep 26 '22 11:09

rpetrich