我有UITableView
一堆UITableViewCell
s。这些UITableViewCell
s 里面有多个UITextField
s。
现在,每次我上下滚动,UITableViewCell
s 离开视图,然后再回来,我在里面输入的任何文本都会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];