I am new to world of Objective C
I am generating dynamic textfields and trying to fetch .text value from each textfield on button press but the problem i am facing is only value in last textfield is fetched
eg- if 3 dynamic textfeilds are generated and i enter values 1,2,3 in textfeilds respectively i want all these values but currently i am getting value from only last textfeild
the code i am trying is as below //this function generates dynamic textfeilds
- (void)dynamicTextboxes {
NSString *string = txt1.text;
int Pointsvalue = [string intValue];
int x;
for (x=0; x < Pointsvalue ; x++)
{
txtFldFrame1 = [[UITextField alloc] initWithFrame:CGRectMake(100,60*x,120,45)];
txtFldFrame1.borderStyle=UITextBorderStyleRoundedRect;
txtFldFrame1.keyboardType=UIKeyboardTypeNumberPad;
[self.view addSubview:txtFldFrame1];
ArrPut=[[NSMutableArray alloc]initWithObjects:txtFldFrame1, nil];
}
}
// function to Acess the values
NSString *string = txt1.text;
int Pointsvalue = [string intValue];
int x;
for (x=0; x < Pointsvalue ; x++)
{
NSString * values=txtFldFrame1.text;
[ArrPut addObject:values];
if(txtFldFrame1.text.length>0)
{
ArrClick=[NSMutableArray array];
[ArrClick addObjectsFromArray:ArrPut];
}
}
NSLog(@"%@",ArrClick);
can anybody help me out Thanks in advance