I have this in my table view controller, and i want to pass the cell's text value to my UITextField on the modal view.
- (void)buttonTapped:(id)sender {
AddName *addName = [[AddName alloc] init];
UITableViewCell *cell = (UITableViewCell*)[sender superview];
NSLog(@"text in buttontapped: %@", cell.textLabel.text);
addName.nameField.text = cell.textLabel.text;
addName.delegate = self;
[self presentModalViewController:addName animated:YES];
}
The NSLog shows the correct cell text value.
On my modal view's viewDidLoad method i have this... and the text value never gets set...
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"text: %@",nameField.text);
nameField.autocapitalizationType = UITextAutocapitalizationTypeWords;
nameField.autocorrectionType = UITextAutocorrectionTypeDefault;
[nameField becomeFirstResponder];
}
What's going on?
Thanks.