[英]How to know which row and which section is editing
I have 10 sections and each section has only 1 row. 我有10个部分,每个部分只有1行。 Row contain 5 text fields.
行包含5个文本字段。 if I change any text field value how to update to particular row ?
如果我更改任何文本字段值,如何更新到特定行?
It should not effect to another sections rows. 它不应影响其他部分的行。 I have taken customview for cell designing.
我已采用customview进行单元设计。
Check the https://stackoverflow.com/a/2... answer. 检查https://stackoverflow.com/a/2 ...答案。 Set the tag for textfield and use Dictionary to store values, Otherwise the reusing cell the textfield text re-appearing in other cells.
设置文本字段的标记,并使用“字典”存储值;否则,重用单元格将使文本字段文本重新出现在其他单元格中。
cellForRowAtIndexPath
return section and row... Do your own logic in Dict to store textfield values... cellForRowAtIndexPath
返回节和行...在Dict中执行自己的逻辑来存储文本字段值...
[txtfield addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
-(void)textFieldDidChange:(UITextField *)txtField
{
UILabel *label = (UILabel *)[txtField.superview viewWithTag:100];
NSString *labelString = label.text;
NSString *textFieldString = txtField.text;
[amounts setObject:textFieldString forKey:labelString];
}
Maintain unique key for cell or textfield to store in dict, check the dict for key exist, if exist change the value else add new key with value. 保持单元格或文本字段的唯一键存储在dict中,检查dict是否存在键,如果存在则更改值,否则用值添加新键。
I think this is, what you want...Do your best... 我想这就是您想要的...尽力而为...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.