How to get values of textfields in tableview in ios5? I have tried tags but its not working.
Probably you use custom cells. If you want to get text values when cell become selected (you need to set tag for UITextField when you create it or in xib file):
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITextField *textField = [[tableView cellForRowAtIndexPath:indexPath] viewWithTag:1];
NSSTring *text = textField.text;
}
Or you can set delegate to UITextField when you create cell
In
- (UITableViewCell*)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
Set delegate
UITextField *textField = [cell viewWithTag:1];
textField.delegate = self;
You can read about UITextField delegate here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.