ioscompletion-block

using didDismissCompletionHandler in MZFormSheetController


I'm using MZFormSheetController to present modals in my app. There is a situation where I want to present a second sheet controller right after I dismiss the first one. In order to do that, there is a completion block, but I can't figure out how to actually use it.

The code looks like this:

[self mz_presentFormSheetController:formSheet
                               animated:YES
                      completionHandler:^(MZFormSheetController *formSheetController) {
                          formSheetController.didDismissCompletionHandler;
                      }];

in that completion handler, what am I supposed to do to get notified of the sheet dismissal so I can then call the second sheet?


Solution

  • This is actually pretty simple, but not totally intuitive if you haven't spent some time in this type of environment.

    [self mz_presentFormSheetController:formSheet
                                   animated:YES
                          completionHandler:^(MZFormSheetController *formSheetController) {
                              formSheetController.didDismissCompletionHandler = ^(UIViewController *presentedViewController){
                                      [self presentOtherController];
                              };
                          }];