English 中文(简体)
• 如何使用国际律师联合会发出电子邮件 项目[复制]
原标题:How to send email using UIBarButtonItem [duplicate]
This question already has answers here:
Closed 11 years ago.

Possible Duplicate:
how to send email using UIbarbuttonitem without using MFMailComposerViewController

As shown in the image this app used to send mail on send button s click.

I found that it is not showing MFMailComposerViewController.

“entergraph

如何才能做到这一点? 我如何利用这一功能?

问题回答

象你一样,你刚刚需要仔细读写。

I found this via Google:

New In 3.0 Tutorial Series, Part2: In App Email, 信技部

是的,它说的是“iPhone 3.0”,但同样的概念和守则在5号SOS中应完全有效。

- (void)MailButton:(id)sender
{
    if ([MFMailComposeViewController canSendMail]) {
        //atableView.scrollEnabled=YES;
        //[socailNetworkView removeFromSuperview];
    //  self.navigationItem.title = @"Contents";
        MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
        mailViewController.mailComposeDelegate = self;
        [mailViewController setSubject:@""];
        [mailViewController setMessageBody:@"" isHTML:NO];
        NSString *string = [NSString stringWithFormat:@"", nil];


        NSArray *mailArr = [[NSArray alloc] initWithObjects:string,nil];
        [mailViewController setToRecipients:mailArr];
        [self presentModalViewController:mailViewController animated:YES];
        [mailViewController release];

    }

    else {

        NSLog(@"Device is unable to send email in its current state");

    }
}


- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error;

{

    NSLog(@"Mail");
    NSString  *str=@"";
    switch (result) {  
        case MFMailComposeResultCancelled:  
            NSLog(@"Mail send canceled.");  
            str=@"
Mail sending cancelled";
            //msgLabel.text=str;
            //          [msgLabel setFont:[UIFont fontWithName:@"Arial" size:18]];
            //          msgLabel.textColor=[UIColor colorWithRed:(54.0/255.0) green:(2.0/255) blue:(1.0/255) alpha:1.0];

            /* 
             Execute your code for canceled event here ... 
             */  
            break;  
        case MFMailComposeResultSaved:  
            NSLog(@"Mail saved."); 
            str=@"Mail saved";
            /* 
             Execute your code for email saved event here ... 
             */  
            break;  
        case MFMailComposeResultSent:  
            NSLog(@"Mail sent.");  
            str=@"Mail sent";
            /* 
             Execute your code for email sent event here ... 
             */  
            break;  
        case MFMailComposeResultFailed:  
            str=@"Mail not sent";
            NSLog(@"Mail send error: %@.", [error localizedDescription]);  
            /* 
             Execute your code for email send failed event here ... 
             */  
            break;  
        default:  
            break;  
    }
    //alertLabel.text=str;
    //  [viewAlert setBackgroundColor:[UIColor clearColor]];
    //  [self.view addSubview:viewAlert];

    [self dismissModalViewControllerAnimated:YES];
}




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签