我自定义了一个tableview,在每个cell里面添加一个textField,当点击textField弹出键盘的时候我想把tableview向上移动,并且改变table的大小,使它不会被键盘覆盖,现在问题是当我改变table的大小的时候,tableview的数据显示出了问题,比如本来是在第二行的数据显示到了最后一行,下面是我的代码,请大家帮忙看看是什么问题。-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if(cell == nil)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:cellIdentifier] autorelease];
cell.lineBreakMode = UILineBreakModeTailTruncation;

UITextField *textfield = [[UITextField alloc] initWithFrame:CGRectMake(20, 6, 180, 32)];
textfield.font = [UIFont fontWithName:@"Arial" size:14.0f];
textfield.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
[textfield addTarget:self action:@selector(edit:) forControlEvents:UIControlEventEditingDidBegin]; [cell addSubview:textfield]; 
[textfield release];
}
return cell;
}
-(void) edit: (UIControl *)sender
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.2];
[self.table setContentOffset:CGPointMake(0,200) animated:YES];
[self.table setFrame:CGRectMake(0,0,320,200)];
[UIView commitAnimations];
}