Reputation:
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];
}
}
Upvotes: 0
Views: 371
Reputation: 9035
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.
Upvotes: 1