@ ppaulojrの答えが機能しなくなったようなSDKが変更されたのか、私のシステムで奇妙なことが起こったのか分かりませんが、以下の調整ができました。
@ ppaulojrの回答にリンクされている投稿は素晴らしいです(http://www.iphonedevsdk.com/forum/iphone-sdk-development/6573-howto-customize-uikeyboard.htmlとhttp://www.iphonedevsdk.com/forum/iphone-sdk-development/6275-add-toolbar-top-keyboard.html)。これは私に役立ちました。
明らかに実際のキーボードビューは、より壮大なUIKeyboardビュー構造でサブビューとして埋め込まれているため、少しの再帰が含まれているようです。私もこの関数を呼び出すのに最適な場所は-(void)textViewDidBeginEditing:(UITextView *)textView
からとても似ていることがわかっ
-(void) findKeyboard {
NSArray* windows = [[UIApplication sharedApplication] windows];
for (int i = 0; i < [windows count]; i++) {
UIWindow* tempWindow = [[[UIApplication sharedApplication] windows]
objectAtIndex:i];
for(UIView *subView in [tempWindow subviews])
{
[self checkViews:subView];
}
}
}
-(void)checkViews:(UIView *)inView
{
for(UIView *keyboard in inView.subviews)
{
NSLog(@"ViewName: %@", [keyboard description]); // Which view are we looking at
//Check to see if the className of the view we have
//referenced is "UIKeyboard" if so then we found
//the keyboard view that we were looking for
if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES)
{
// Keyboard is now a UIView reference to the
// UIKeyboard we want. From here we can add a subview
// to th keyboard like a new button
//Do what ever you want to do to your keyboard here...
break;
}
// Recurse if not found
[self checkViews:subView];
}
}
:私はこれが動作するようになった。これは、すぐにキーボードが追加されると、キーボードの変更を行います
- (void)textViewDidBeginEditing:(UITextView *)textView {
NSLog(@"textViewDidBeginEditing");
[self findKeyboard];
}
ウィンドウが表示されますが、実際に表示される前に、下から上がるまでの時間が変更されます。
ありがとうございました!私はそれを見なければならないでしょう。 JavaとC/C++のバックグラウンドからくるObjective-Cのやり方は時にはちょっと変わってくることがあります。 – alownx