- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
if(textField == yourTextField){ /// here write name of your Textfield in which you want to scroll tableview
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
yourTableView.frame = CGRectMake(yourTableView.frame.origin.x, -160, yourTableView.frame.size.width, tblContactUS.frame.size.height);
[UIView commitAnimations];
}
return YES;
}
,並把你的TableView與前一幀,然後用波紋管方法
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
if(textField == yourTextField){ /// here write name of your Textfield in which you want to scroll down tableview
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
yourTableView.frame = CGRectMake(yourTableView.frame.origin.x, 0, yourTableView.frame.size.width, tblContactUS.frame.size.height);
[UIView commitAnimations];
}
return YES;
}
我希望這可以幫助你...
你確切想要什麼?以及你面臨的問題? –
我只是想滾動tableview如果tableviewcell中的textfield被鍵盤隱藏,因此我添加了tableview的頁腳,這個功能的作品,如果它是一個簡單的TableView的分段tableview它不工作 –