How to execute some code after a segue is done?

前端 未结 5 1381
盖世英雄少女心
盖世英雄少女心 2020-12-03 06:27

Is it possible in iOS 6 to know when a UIStoryboardSegue has finished its transition? Like when i add a UIStoryboardSegue from UIButton

5条回答
  •  甜味超标
    2020-12-03 07:13

    you can call a method of destination UIViewController in prepareForSegue method.

    -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
      NSLog(@"prepareForSegue: %@", segue.identifier);
    
      if ([segue.identifier isEqualToString:@"Happy"]) {
          [segue.destinationViewController setHappiness:100];
      } else if ([segue.identifier isEqualToString:@"Sad"]) {
          [segue.destinationViewController setHappiness:0];
      }
    }
    

    here setHappiness method is of destination Controller and here 100 is passing there. so you can write a method in destination controller and call it here

提交回复
热议问题