Set UITextField text property in prepareForSegue
I have a textField in my ViewController1. I have a push segue to my
ViewController2 which also has a textField. I need to set the
textField.text in my ViewController2 to be equal to the text in the
textField in my ViewController1. Here's the code I have:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqual:@"ViewController2"])
{
ViewController2 *VCT = [segue destinationViewController];
VCT.title = @"View Controller #2";
VCT.textField.text = self.textField.text;
}
}
The title setter works just fine. Why is the textField not working?
No comments:
Post a Comment