My way of doing it would be like this:
Create a singleton instance of the TableViewController where you place a array storing the content of the labels.
@interFace TableViewController : UIViewController
@property (nonatomic,retain) NSMutableArray * labelArr;
+ (id)instance;
@end
static TableViewController *TableViewControllerInstance;
@ implementation TableViewController
+ (id)instance {
static TableViewController *TableViewControllerInstance = nil;
@synchronized(self) {
if (TableViewControllerInstance == nil)
TableViewControllerInstance = [[self alloc] init];
}
return TableViewControllerInstance;
}
-(id)init{
if (self==[super init]){
self.labelArr = [[NSMutableArray alloc] init];
for (int i=0;i<listLength;i++){
[self.labelArr addobject:[NSString stringWithFormat:@""];
}
return self;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
CNExapndingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
if (cell == nil) {
cell = [[[CNExapndingTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"MyIdentifier"] autorelease];
}
[cell.textView setText: [self.labelArr objectAtIndex:indexPath.row]];
cell.tag = indexpath.row;
return cell;
}
@end
Then in the CNExapndingTableViewCell check when the UITextField value changes and update the Array value
- (BOOL)textField:(UITextField *)textField
shouldChangeCharactersInRange:(NSRange)range
replacementString:(NSString *)string
{
[[TableViewController instance].labelArr replaceObjectAtIndex:self.tag withObject:textfield.text];
return YES;
}