0
votes

I have a push segue and want to transfer data between views. I need a different way to resign first responder if the user taps the next button in the navigation bar. I have [textField resignFirstResponder]; in the navigation bar button method but for some reason it is called after the next page viewDidLoad.

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([segue.identifier isEqualToString:[NSString stringWithFormat:@"thridClubPage"]]) {
    thirdClubPage *nextPage = segue.destinationViewController;

    nextPage.title = self.navigationItem.title;
    nextPage.location = self.collegeString;
    nextPage.people = self.membersString;
    nextPage.leader = self.presidentString;
    nextPage.Email = self.presidentEmailString;
}
}

- (IBAction)finishPage:(id)sender {
[self.presCell.presidentEmail resignFirstResponder];
}

the segue performs without resigning the textField.

1

1 Answers

0
votes

A quick solution is to delete the segue from the button in IB and redraw it between the two view controllers. (In other words, when dragging out the segue, don't control-drag from the button, control-drag from the view controller that contains it). Give the segue an identifier, like @"NextSegue".

Now you can control the order of what happens by triggering the segue yourself...

- (IBAction)finishPage:(id)sender {
    [self.presCell.presidentEmail resignFirstResponder];
    [self performSegueWithIdentifier:@"NextSegue" sender:self];
}