tags:

views:

101

answers:

1

Hi, 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];
}

}

+1  A: 

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.

JustinXXVII
it shows like pushview controller from current view controller when we press mail button.but some times it is not working?
Mikhail Naimy