Как я могу определить исчезновение встроенного в приложение MFMailComposeViewController? - PullRequest
0 голосов
/ 26 ноября 2011

Я настроил некоторый код для запуска MFMailComposeViewController, чтобы пользователи приложения могли отправлять электронные письма людям из приложения. Как я могу определить, когда этот контроллер вида исчез?

Спасибо!

1 Ответ

0 голосов
/ 26 ноября 2011

Это может быть полезно для вас. Здесь вы можете узнать, какую кнопку он нажал. Так что вы можете знать, отображается ли композитор почты или нет

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
{   
    // Notifies users about errors associated with the interface
    switch (result)
    {
        case MFMailComposeResultCancelled:
            //NSLog(@"Result: canceled");
            break;
        case MFMailComposeResultSaved:
            //NSLog(@"Result: saved");
            break;
        case MFMailComposeResultSent:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Result" message:@"Mail Sent Successfully" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
            [alert show];
            [alert release];
        }
            break;
        case MFMailComposeResultFailed:
            //NSLog(@"Result: failed");
            break;
        default:
            //NSLog(@"Result: not sent");
            break;
    }
    [self dismissModalViewControllerAnimated:YES];
}
...