如果用户点击最后一个单元格的文本字段,则我已在普通样式中为UITableView
添加了一个页脚
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection: (NSInteger)section{
UIView *view =[[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
[view setBackgroundColor:[UIColor blackColor]];
return view;
}
如果是分段表,请帮助
答案 0 :(得分:0)
- (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;
}
我希望这可以帮助你...