I'm creating a form and was wondering if anyone knows how to retrieve a UITextField value from a table cell.
- (IBAction)saveForm:(id)sender {
NSLog(@"TextField Value => %@", titleField.text);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
...
switch(indexPath.section)
{
case 0:
if (row == 0) {
cell.selectionStyle = UITableViewCellSelectionStyleNone;
CGRect titleFieldFrame = CGRectMake(20.0, 80.0, 280.0, 25.0);
UITextField *titleField = [[UITextField alloc] initWithFrame:titleFieldFrame];
[titleField setBorderStyle:UITextBorderStyleRoundedRect];
[titleField setTextColor:[UIColor blackColor]];
[titleField setFont:[UIFont systemFontOfSize:16]];
[titleField setPlaceholder:@"Title"];
[titleField setBackgroundColor:[UIColor whiteColor]];
titleField.keyboardType = UIKeyboardTypeDefault;
titleField.returnKeyType = UIReturnKeyDone;
[cell addSubview:titleField];
}
break;
return cell;
}