views:

1591

answers:

2

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. http://stackoverflow.com/questions/630265/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 :)

A: 

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

Paul Betts
Thanks for the heads up, I'm a far way away from submitting apps though. Do you think it's possible to do?
TEEKAY
Paul is right. Apple might not approve the app if it uses a hack or uses private api methods
lostInTransit
+7  A: 

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

rpetrich
thank you very much
TEEKAY