私は困惑しており、誰かが助けてくれることを願っています。
セグエの前に、5 つのテキスト フィールドすべてに対して Resign ファーストレスポンダー メソッドを呼び出しています。セグエが発生します。セグエの前にキーボードが表示されていた場合、何をしてもキーボードは残ります。これは、IOS6 では発生しませんでした。IOS7 でのみ発生しています。
どうぞよろしくお願いいたします。
シナリオは次のとおりです。
ユーザーは一度に 1 つのテキスト フィールドに触れてデータを入力します。キーボードは、あるフィールドから次のフィールドへのファーストレスポンダーの変更に問題はなく、問題なく DONE ボタンから辞任することができます。問題は、ユーザーがピッカー ビューから入力されるフィールドに触れたときに発生します。以前のテキスト フィールドのいずれかからキーボードが表示されていた場合、それは消えません。
このコードは、2 つのフィールドresignFirstResponder
のeditingDidBegin
アクションを実行しようとしています。これらの 2 つのフィールドを使用して数値を保持していますが、次のビューでピッカーから入力しています。
- (IBAction)txtRatioOrHullTypeTouched:(id)sender
{
// Hide the keyboard before the segue to the picker occurs.
[self.txtPitch resignFirstResponder];
[self.txtRPM resignFirstResponder];
[self.txtSlipOrSpeed resignFirstResponder];
[self.txtRatio resignFirstResponder];
[self.txtHullType resignFirstResponder];
segueToPicker = YES; // Raise flag indicating that this segue is to the picker.
[self performSegueWithIdentifier:@"toPicker" sender:sender];
}
viewWillDisappear
ここに示すように、これと同じコードも入れます。
- (void)viewWillDisappear:(BOOL)animated // Unchanged
{
// Hide the keyboard before the segue to the picker occurs.
[self.txtPitch resignFirstResponder];
[self.txtRPM resignFirstResponder];
[self.txtSlipOrSpeed resignFirstResponder];
[self.txtRatio resignFirstResponder];
[self.txtHullType resignFirstResponder];
[super viewWillDisappear:animated];
}
これらのメソッドは両方とも、初期ビューの ViewController.m ファイルにあります。