如何在webview中打开应用程序内的邮件?

时间:2013-02-11 07:50:25

标签: iphone objective-c email ios6

这是我的代码..

if ([ [ requestURL scheme ] isEqualToString: @"mailto" ])

 {

        MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
        [composer setMailComposeDelegate:self];
        if ([MFMailComposeViewController canSendMail]) {
            NSString *strEmail = [NSString stringWithFormat:@"%@",requestURL];
            NSString *subString = [[strEmail componentsSeparatedByString:@":"] lastObject];
            [composer setToRecipients:[NSArray arrayWithObjects:subString, nil]];
            [composer setSubject:@"Kreativ-Q"];
            [composer setMessageBody:@"" isHTML:YES];
            [composer setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
            [self presentModalViewController:composer animated:YES];
            [composer release];
        }
    }

但是当我点击webview中的链接时,它会在mailBox中打开。当我从那里发送或取消邮件并返回我的应用程序时,邮件仍在那里。他们给我看了两次。我只想要,它只会在我的应用程序中打开..

提前致谢。

1 个答案:

答案 0 :(得分:0)

可以帮到你:

如果你没有,请在.h文件中设置此委托。

<MFMailComposeViewControllerDelegate>