简体   繁体   中英

problem in apple's MFMailComposeViewController

i have code in my current navigation controller in which one button for that.... but when i click button mailcomposer appears **but current navigation controller and its view disappears and then it works... how can i avoid that disappearance,anyhelp please **...... - (IBAction)clickedMailButton:(id)sender {

Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
if (mailClass != nil)
{
    // We must always check whether the current device is configured for sending emails
    if ([mailClass canSendMail])
    {
        [self displayComposerSheet];
    }
    else
    {
        [self launchMailAppOnDevice];
    }
}
else
{
    [self launchMailAppOnDevice];
}

}

Clarify what you mean when you say everything disappears. The class might be deciding that your device is not set up to send e-mails, so it does [self launchMailAppOnDevice];

which closes the running app and launches Mail.app

If you have your email set up on the device, a modal view appears and is dismissed when you click send or cancel, revealing your app again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM