ios - Is it Possible to Dismiss MFMailComposeViewController Without User Interaction? -
i able dismiss mfmailcomposeviewcontroller
in didfinishwithresult
delegate method. however, have scenario dismiss composer without user interaction, selecting cancel or sending mail.
i have looked in apple docs , unable find entirely useful. have tried calling dismissviewcontrolleranimated
seems working when inside didfinishwithresult
delegate method. there anyway force delegate method or dismiss composer alternatively?
assuming presenting mail controller uiviewcontroller
, may dismiss programmatically calling uiviewcontroller
method:
dismissviewcontrolleranimated:completion:
see apple reference: dismissviewcontrolleranimated:completion:
you did mention:
i have tried calling dismissviewcontrolleranimated seems working when inside didfinishwithresult delegate method
what experiencing may indicative of different problem able outside of mailcomposecontroller:didfinishwithresult:error:
delegate method.
example:
-(void)showmail { mfmailcomposeviewcontroller *mailcontroller = [[[mfmailcomposeviewcontroller alloc] init] autorelease]; //set message, subject, etc... //display [someviewcontroller presentviewcontroller:mailcontroller animated:yes completion:nil]; //as proof of concept, close programmatically after couple of seconds... [self performselector:@selector(dismissmailcontroller) withobject:nil afterdelay:2.0]; } -(void)dismissmailcontroller { [someviewcontroller dismissviewcontrolleranimated:yes completion:nil]; }
Comments
Post a Comment