我正在项目中有很多形式(如注册表格)大约20-25forms在那里,每个窗体都有8-9输入框即textfields。在UITableViewCell中的文本获取当用户滚动时删除uitableview
1)我已创建自定义的UITableViewCell 2)I在指数为行小区i写以下代码:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if(indexPath.row==0){
NSString *simpleTableIdentifier = @"cell";
customcell *cell = (DropdownCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:customcell owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.Txtlist.placeholder = @"Select type of meeting";
self.txtType1 = cell.Txtlist; // i had created the local variable uitextfield.So that i can access that locally in my application.
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
else if(indexPath.row == 1){
NSString *simpleTableIdentifier = cell;
customcell *cell = (customcell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:customcell owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.Txtlist.placeholder = @"Select Client Name";
self.txtType2 = cell.Txtlist; // i had created the local variable uitextfield.So that i can access that locally in my application.
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
}
3)UI是否合适。 但问题是,当我在行= 0的文本字段中写入一些文本并滚动uitableview。 textfield的值得到删除。
我该如何解决这个问题。 请帮忙。 也帮助我,如果有更好的方法来实现窗体。
谢谢
谢谢你的快速回复。你能帮我指出一个确切的错误吗? –