Iphone 如何从动态创建的带有Plist标记的textfield中添加和获取值
我想从动态创建的textfield中添加值,并从plist中获取标记。。。。 我怎么能这样做Iphone 如何从动态创建的带有Plist标记的textfield中添加和获取值,iphone,objective-c,ios,Iphone,Objective C,Ios,我想从动态创建的textfield中添加值,并从plist中获取标记。。。。 我怎么能这样做 Txt_New_Estimated = [[UITextField alloc]initWithFrame:CGRectMake(360, textPosY , 130, 65)]; Txt_New_Estimated.delegate = self; Txt_New_Estimated.text=@""; Txt_New_Estimated.tag = i; Txt_New_Estimated.cl
Txt_New_Estimated = [[UITextField alloc]initWithFrame:CGRectMake(360, textPosY , 130, 65)];
Txt_New_Estimated.delegate = self;
Txt_New_Estimated.text=@"";
Txt_New_Estimated.tag = i;
Txt_New_Estimated.clearButtonMode = UITextFieldViewModeWhileEditing;
[Txt_New_Estimated addTarget:self action:@selector(C6Loop) forControlEvents:UIControlEventEditingChanged];//UIControlEventEditingDidEnd
Txt_New_Estimated.placeholder = @"Estimated";
Txt_New_Estimated.font = [UIFont fontWithName:@"Arial" size:23];
Txt_New_Estimated.backgroundColor = [UIColor whiteColor];
Txt_New_Estimated.textAlignment = UITextAlignmentCenter;
[scrollview addSubview:Txt_New_Estimated];
[textFieldArray addObject:Txt_New_Estimated];
如何添加具有如下标记的对象
[form1Array1 addObject:Txt_New_ONU.text]//三,
我想在标签上添加textfield的每个索引的值
如何添加、保存和通过plist检索textfild标记上的值。。。。喜欢这条线吗
[form1Array1 addObject:Txt_New_ONU.text]//三,
它将值保存在plist上的第三个位置。。。。如何保存n检索标记上动态创建的文本字段值,i位置n如何检索?将plist的内容读取到数组:
// Path to the plist (in the application bundle)
NSString* path = [[NSBundle mainBundle] pathForResource:@"PlistFile" ofType:@"plist"];
// Build the array from the plist
NSMutableArray* arr = [[NSMutableArray alloc] initWithContentsOfFile:path];
遍历数组以创建带有标记的文本字段,并将其添加到新数组中:
NSMutableArray* newArr = [NSMutableArray array];
for(int i=0; i<[arr count]; i++)
{
UITextField field = [[UITextField alloc]initWithFrame...
field.tag = i;
(...) // other initialization code
[newArr addObject:field];
}
NSMutableArray*newArr=[NSMutableArray];
对于(int i=0;它对我不起作用,先生,请给出一些其他想法…请。好的,什么对您不起作用?是否存在编译器错误?标记是否存储不正确?由于某种原因,您无法使用此解决方案?您可以添加日志以查看存储和返回的值吗?或者您可以在调试时查看这些值吗?先生,y我们的代码现在工作得很好,我在代码中修改了一些东西,然后再次尝试你的代码,现在它工作得很好……非常感谢,先生……GR88帮助……太棒了!如果你解决了你的问题,你能考虑把我的回答标记为答案吗?