jeudi 4 décembre 2014

how to compose mail when button at index clicked in UIActionSheet?

i am little bit confused how to display mail composer when i clicked email option in UIActionSheet here's my sample code:



-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
if(buttonIndex == 0)
{
NSString *emailTitle = @"Test Email";
NSString *messageBody = @"iOS programming is so fun!";
NSArray *toRecipents = [NSArray arrayWithObject:@"support@email.com"];
MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
mc.mailComposeDelegate = self;
[mc setSubject:emailTitle];
[mc setMessageBody:messageBody isHTML:NO];
[mc setToRecipients:toRecipents];
[self presentViewController:mc animated:YES completion:NULL];
}
}



Aucun commentaire:

Enregistrer un commentaire