この質問に対する回答が見つかりました。それは標準だが、Daveのように、アプリのレビューアにとってはタブーになるかもしれない。出発点として、このページからコードを使用して:
http://unsolicitedfeedback.com/2009/02/06/how-to-customize-uikeyboard-by-adding-subviews/
Iアニメーションブロックに加えました。標準の見た目のアニメーションでキーボードビューを閉じることはできますが、最初のレスポンダはそのステータスを保持します。本当に、キーボードはスクリーンから隠されているだけです。
- (void)hideKeyboard
{
for (UIWindow *keyboardWindow in [[UIApplication sharedApplication] windows]) {
// Now iterating over each subview of the available windows
for (UIView *keyboard in [keyboardWindow subviews]) {
// Check to see if 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) {
// animate the keyboard moving
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.4];
// remove the keyboard
CGRect frame = keyboard.frame;
// if (keyboard.frame.origin.x >= 0) {
if (keyboard.frame.origin.y < 480) {
// slide the keyboard onscreen
//frame.origin.x = (keyboard.frame.origin.x - 320);
// slide the keyboard onscreen
frame.origin.y = (keyboard.frame.origin.y + 264);
keyboard.frame = frame;
}
else {
// slide the keyboard off to the side
//frame.origin.x = (keyboard.frame.origin.x + 320);
// slide the keyboard off
frame.origin.y = (keyboard.frame.origin.y - 264);
keyboard.frame = frame;
}
[UIView commitAnimations];
}
}
}
}
コードを書いて、キーボードを画面の左下に閉じます。私はあなたが最終的にresignFirstResponder
のときに何が起こるかわからないが、それをするときにキーボードフレームをリセットすることが考えられるかもしれない。
私はデータ入力システムが欲しくないとは言わなかった。キーボードを消したいだけだ。私はいつもと違った位置にカスタムキーボードを作りたい。それはあなたが考えているデータ入力システムです。 –