Perform push segue after an unwind segue

前端 未结 7 2364
失恋的感觉
失恋的感觉 2020-12-05 02:24

I am working on a camera app where the camera views are shown modally. After I am done with cropping. I perform an unwind segue to the MainPageViewController. (

7条回答
  •  不思量自难忘°
    2020-12-05 02:56

    Taking forward this answer (I only had Objective-C code)

    Subclass UIStoryBoardSegue

    #import 
    
    @interface MyStoryboardSegue : UIStoryboardSegue
    
    /**
     This block is called after completion of animations scheduled by @p self.
     */
    @property (nonatomic, copy) void(^completion)();
    
    @end
    

    And call this completion block after completion of animations.

    @implementation MyStoryboardSegue
    
    - (void)perform {
      [super perform];
      if (self.completion != nil) {
        [self.destinationViewController.transitionCoordinator
         animateAlongsideTransition:nil
         completion:^(id context) {
           if (![context isCancelled]) {
             self.completion();
           }
         }];
      }
    }
    
    @end
    

提交回复
热议问题