UITableView
のサイズを変更し、このフィールドが発生するとUITextField
を含むUIView
をスライドさせます。UITextFieldが起動されたときに、同期してUIViewをスライドしてUITableViewのサイズを変更します。
今、私はこのコードを持っている:
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.3];
[UIView setAnimationBeginsFromCurrentState:YES];
[myView setFrame:CGRectMake(myView.frame.origin.x, myView.frame.origin.y - 167, myView.frame.size.width, myView.frame.size.height)]; // 216 (keyboard's height) - 49 (tabbar's height) = 167
[UIView commitAnimations];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.3];
[UIView setAnimationBeginsFromCurrentState:YES];
[myView setFrame:CGRectMake(myView.frame.origin.x, myView.frame.origin.y + 167, myView.frame.size.width, myView.frame.size.height)];
[UIView commitAnimations];
return TRUE;
}
問題はアニメーションアップアニメーションやmyView
スライドアップキーボードのスライドが同期していないということですこれらは、2つの簡単なモックアップです。これらの2つのアニメーションを完全に同期させるには
キーボードが表示されているときにUITableView
のサイズを変更する方法と、キーボードが隠れるときに元の高さに戻す方法はありますか?
[becomeFirstResponderまたはresignFirstResponderのイベントでキーボードの上にオブジェクトを置くことは可能ですか?](http://stackoverflow.com/questions/8704137/keeping-object-on-top-of-keyboard-in-the -event-of-become firstresponder-or-resign) –
一番下に表示するUIViewをtableFooterViewとして使用する方法はありますか?今のすべてがUITableViewControllerにラップされていれば、自由に使いたい機能が得られます。 – Till
@till no UIViewを常に表示したいので。 –