我有UITableView一堆UITableViewCells。这些UITableViewCells 里面有多个UITextFields。
现在,每次我上下滚动,UITableViewCells 离开视图,然后再回来,我在里面输入的任何文本都会UITextField消失。完成这项工作的最佳方法是什么?
static NSString *CellIdentifier = @"Cell";
ComplaintsCustomCell *cell=(ComplaintsCustomCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell==nil){
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"ComplaintsCustomCell" owner:self options:nil];
for(id currentObject in topLevelObjects){
if([currentObject isKindOfClass:[UITableViewCell class]]){
cell = (ComplaintsCustomCell *) currentObject;
break;
}
}
}
cell.durationFld.text=[dict valueForKey:@"Duration"];
[cell.durationFld setTag:indexPath.row + 5000];