Q: ios get text value from textfield in tableViewCell In my ViewController, I had created a textField with name UITextField *txtMyName;
After that, I was added my textField to tableViewCell [cell addSubview:txtMyName];
I can edit text in my textField, but when I get text from textField _strFullName = txtMyName.text;
But, it's get empty values.
How to I can resolve this problem!
***** Edited****
if (indexPath.row == 0) {
        [self setFrameTextField:cell];
        [self CustomTextField:cell :txtMyName];
        if ([[dict_infoFriend objectForKey:@"Fullname"] isEqualToString:@" "]) {
            txtMyName.placeholder = @"Name";
        }
        else{
            txtMyName.text = [dict_infoFriend objectForKey:@"Fullname"];
        }
        [cell addSubview:txtMyName];
    }
else if (indexPath.row == 1){
        button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
            button.frame = CGRectMake(cell.frame.size.width - 10, 0, 130, 40);
        }
        else{
            button.frame = CGRectMake(cell.frame.size.width / 2 - 65, 0, 130, 40);
        }
        [self CustomBTN:button];
        [button addTarget:self action:@selector(ClickDone) forControlEvents:UIControlEventTouchUpInside];
        [cell addSubview:button];
    }


A: you haven't assign memory to your textfield yet thats why you are able to edit but not able to retrive it. just write txtMyName = [[UITextfield alloc]init];  you can assign frame to textfield like txtMyName = [[UITextfield alloc]initWithFrame:CGRectMake(x,y,width,height)]; once you assign memory to your textfield then you will be retrive the text from textfield

A: Since you have added the textfield into table cell, you've to get the cell first then using tag of textfield you can get the text.
Try like this,
Assume that you have tag for textfield like txtMyName.tag = 100
-(void) ClickDone {
      NSIndexPath *indexPath = [[NSIndexPath alloc] indexPathForRow:0 inSection:0];
     UITableViewCell *cell = [tableView cellForRowAtIndexPath:lastIndexPath];
     UITextField *txtField = (UITextField *)[cell viewWithTag:100];
     _strFullName = txtField.text;
  }

