Iphone键盘透明度

TEE*_*KAY 5 iphone keyboard transparency

首先,我对iPhone开发人员如此新鲜,如果这很容易,我很抱歉.

是否可以改变iPhone键盘上的透明度(如果可能的话,甚至是颜色).

我知道您可以获得键盘视图的参考(提供的链接) http://www.iphonedevsdk.com/forum/iphone-sdk-tutorials/7350-adding-subviews-custimize-keyboard.html

我发现这个stackoverflow帖子让我相信它可以通过动画来完成. iPhone UIView动画最佳实践

但我不知道我会把这段代码放在哪里.

感谢您的任何想法和意见.一切友好的赞赏:)

-TK

谢谢你的评论.我不在乎它是否通过了应用程序商店.只是想尝试去做.再次感谢 :)

rpe*_*ich 13

公共API中只有两种样式:

[textView setKeyboardAppearance:UIKeyboardAppearanceAlert];
[textView setKeyboardAppearance:UIKeyboardAppearanceDefault];
Run Code Online (Sandbox Code Playgroud)

但您可以使用私有API方法来检索键盘实现:

id keyboardImpl = [objc_getClass("UIKeyboardImpl") sharedInstance];
Run Code Online (Sandbox Code Playgroud)

并减少不透明度,

[keyboardImpl setAlpha:0.8f];
Run Code Online (Sandbox Code Playgroud)

色调吧,

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];
Run Code Online (Sandbox Code Playgroud)

甚至翻转它:

[[keyboardImpl window] setTransform:CGAffineTransformMakeScale(-1.0f, 1.0f)];
Run Code Online (Sandbox Code Playgroud)

但所有这些都会阻止您的应用获得批准