赞
踩
引入头文件:
#import <MessageUI/MessageUI.h>
@interface InviteViewController : UIViewController<MFMessageComposeViewControllerDelegate>
- - (IBAction)send:(id)sender
- {
- if( [MFMessageComposeViewController canSendText] ){
-
- MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc]init];
-
- controller.recipients = haveSelectedArray;//短信接收者,为array
- controller.body = _adTextView.text;//短信内容
- controller.messageComposeDelegate = self;
-
- [self presentModalViewController:controller animated:YES];
-
- [[[[controller viewControllers] lastObject] navigationItem] setTitle:@"叽歪邀请"];//修改短信界面标题
- }
- }
-
- //MFMessageComposeViewControllerDelegate
- - (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result{
-
- [controller dismissModalViewControllerAnimated:NO];
-
- switch (result) {
-
- case MessageComposeResultCancelled:
-
- break;
- case MessageComposeResultFailed:// send failed
-
- break;
- case MessageComposeResultSent:
-
- break;
- default:
- break;
- }
-
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。