使用QLPreviewController发送电子邮件帐户信息

时间:2014-04-21 04:41:52

标签: ios objective-c qlpreviewcontroller

我正在使用QLPreviewController来展示pdf。我点击分享按钮发送pdf,然后点按QLPreviewController

中的电子邮件

但我不知道如何在QLPreviewController中获取该共享按钮方法以验证该电子邮件帐户是否可用。这是截图:

enter image description here 请让我知道这件事。

提前致谢。

2 个答案:

答案 0 :(得分:0)

如果您有UInavigationController,则可以添加条形按钮以共享内容。或者您可以在viewcontroler中添加共享按钮。

使用MessageUI。添加代理人MFMessageComposeViewControllerDelegate, MFMailComposeViewControllerDelegate

- (IBAction)contactBtn:(id)sender {
    if ([MFMailComposeViewController canSendMail]){
        MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
        [controller setSubject:@"Subject"];
        [controller setMessageBody:@" " isHTML:NO];
        [controller setToRecipients:[NSArray arrayWithObjects:@"a@wa.com",nil]];
        controller.mailComposeDelegate = self;
        [self presentViewController:controller animated:YES completion:NULL];
    }
    else{
        UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Failed!" message:@"Mail can not be sent. Check your email settings." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil] ;
        [alert show];
    }
}

- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
    [self dismissViewControllerAnimated:YES completion:NULL];
}

答案 1 :(得分:0)

QL预览器正在处理单独的进程。像一个不同的应用程序。因此无法自定义共享按钮。查看详细信息here

这可能会对你有所帮助。请参阅此answer