After going through the solution for this query, I get the output in the log when i print the mutableArray as shown below.
*Date Project name :* Save button : (
Def
)
where 'Def' is the text entered in the textfield created dynamically. I want to extract 'Def'and display in log on save button click. Here's the code
- (IBAction)save:(id)sender {
for(UITextField *field in self.scroll.subviews)
{
if([field isKindOfClass:[UITextField class]])
{
if([[field text] length] > 0)
{
NSMutableArray *mutableTextArray = [[NSMutableArray alloc] init];
[mutableTextArray addObject:field.text];
NSLog(@"Save button : %@", mutableTextArray);
//NSString *str = [str stringByAppendingString:[mutableTextArray objectAtIndex:0]];
//[self fetchStrings:str];
}
}
}
}
- (void) fetchStrings:(NSString*)enteredString
{
NSLog("%@", enteredString); //want 'def' to be displayed here
}
mutableTextArrayshould be instance level variable and not local. Then it will be accessible across instance methods.