モーダルUINavControllerの保存ボタンに問題があります。保存ボタンを押すと、キーボードがまだ開いている場合はキーボードを閉じ、テキストフィールドのデータを検証してから、情報を送信するときにUIProgressViewを表示します。
私の問題は、キーボードが十分に速く邪魔にならないことです。そのため、UIProgressViewを表示するときにキーボードがまだ開いていて、ビューの下部に追加されていて、ばかげているように見えます。
リターンキーを押すとキーボードが下がり、保存を押しても問題ありません。しかし、ユーザーがキーボードのリターンキーをスキップして右上の保存ボタンに進むと、問題が発生します。
理想的には、それが見えなくなるまでの短い待機ステートメントを実装したいと思います。または、遅延後に検証を実行しますが、試したことは何も機能していません。助けてください。
コード例:
// end edit mode - should kill all keyboards
[[self.tableView superview] endEditing:YES];
// make sure everything is entered correctly and validates
[self validateEntryFields]; // keyboard not gone when this finishes
if (valid) { // progress view shows up towards bottom of view
HUD = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:HUD];
HUD.delegate = self;
HUD.labelText = @"Adding User";
HUD.detailsLabelText = @"Please Wait";
[HUD showWhileExecuting:@selector(sendNewUserInformation) onTarget:self withObject:nil animated:YES];
}