UITableviewのカスタムセルにTextFieldがあります。TableviewはMainViewの下部にあるため、CustomCellキーボードでTextFieldをクリックすると、テキストフィールドが非表示になります。下の画像は問題を示しています。
ここに、MainViewにUITextFieldがある場合に機能するコードがあります。UITextfieldをクリックすると、ビュー全体のアニメーションが必要になるため、以下のコードを編集してください。
-(void)textFieldDidBeginEditing:(UITextField *)textField {
if (textField.tag > 0) {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.5];
[UIView setAnimationBeginsFromCurrentState:YES];
self.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y-165.0,
self.view.frame.size.width, self.view.frame.size.height);
[UIView commitAnimations];
}
}
-(void)textresign{
[[self.view viewWithTag:1]resignFirstResponder];
}
-(void)textFieldDidEndEditing:(UITextField *)textField {
if (textField.tag > 0) {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.5];
[UIView setAnimationBeginsFromCurrentState:YES];
self.view .frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y+165.0,
self.view.frame.size.width, self.view.frame.size.height);
[UIView commitAnimations];
}
}
しかし、カスタムセルUITextFieldの修正方法がわかりませんでした。ヘルプが適用されます。