1
我有文本字段中的UITableView的自定義單元格。我泰伯維是的MainView的下部,所以當我在CustomCell鍵盤,點擊文本字段出現哪些隱藏下面的圖片我textfield.My顯示我的問題如何在UITableview的CustomCell中單擊UITextField時移動查看?
在這裏,我有一個代碼,當我在MainView中有UITextField時可以工作。請編輯下面的代碼Beacuse我希望整個視圖動畫,當我點擊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.Any幫助將appriated。
感謝它的工作原理,但移動後視圖永不停止。 – jamil
@SHAZAD調試並檢查此'textFieldShouldReturn'方法,無論您何時嘗試退出鍵盤,都會調用此方法。 – Kamarshad
得到它感謝它現在工作正常。 – jamil