How to do something before unwind segue action?

后端 未结 3 592
情深已故
情深已故 2020-12-09 04:16

I\'ve just figured out what is an unwind segue and how to use it with the great answers from this question. Thanks a lot.

However, here\'s a question like this:

3条回答
  •  情话喂你
    2020-12-09 05:20

    At first, you should call the send data function in prepareForSegue method.

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
        if([[segue identifier] isEqualToString:@"UnwindIdentifier"]) {
            // send data
        }
    }
    

    If you don't want to let unwind segue happen before getting response from the server, you should override

    - (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender
    

    method and return NO;. Then you can perform segue manually when you get the server response by calling:

    [self performSegueWithIdentifier:@"UnwindIdentifier" sender:sender];
    

提交回复
热议问题