ios - Dismissing presenting modal ViewController -
i have viewcontroller
, presents modal viewcontroller. within modal viewcontroller want present mailcomposeviewcontroller
. problem during dismissal. want dismiss both displayed viewcontroller
@ same time.
my predecessor grabbed instance of presentingviewcontroller
, send message display mailcomposeviewcontroller
, dismissed modal viewcontroller in baseviewcontroller
.
[self dismissviewcontrolleranimated:yes completion:^{ [self presentviewcontroller:mailviewcontroller animated:yes completion:nil]; }];
i try prevent this, godclass (over 5kloc) , need tear apart.
so tried use same pattern in modal viewcontroller, used self.presentingviewcontroller
instead. resulted in dismissing modal viewcontroller, not displaying anything.
grabbing instance prior dismissal worked, delegate callback dismissal ignored (no wonder, modal viewcontroller not displayed anymore).
so going delegate callback - (void) mailcomposecontroller:(mfmailcomposeviewcontroller*) controller didfinishwithresult:(mfmailcomposeresult) result error:(nserror*) error
i tried dismiss modal viewcontroller prior mailcomposeviewcontroller
without animation. removes mailcomposeviewcontroller
(also no surprise). dismiss first mailcomposeviewcontroller
, modal viewcontroller, creates different animation in controllers dismissed @ different time , order (and know how ux reacts ;)).
so there other options, in can dismiss first modal viewcontroller , display mailcomposeviewcontroller
, without having dismissal code in baseviewcontroller
?
thanks :)
the presenting view controller responsible dismissing view controller presented. if call method on presented view controller itself, automatically forwards message presenting view controller.
on other hand presenting view controller of course responsible presenting. there no way presenting new view controller without having dismissal code in baseviewcontroller
in case presenting view controller
you can dismiss without animate present new one
[self dismissviewcontrolleranimated:no completion:^{ [self presentviewcontroller:mailviewcontroller animated:yes completion:nil]; }];
Comments
Post a Comment