首页 > 代码库 > iOS 发短信

iOS 发短信

1. 导入库:

MessageUI.framework

2. 声明代理类:

MFMessageComposeViewControllerDelegate

3. 功能函数的实现:

比如:

    MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];

    picker.messageComposeDelegate = self;

    picker.navigationBar.tintColor = [UIColor blackColor];

    picker.body = @"";

    picker.recipients = [NSArray arrayWithArray:phoneArr];

    [self presentViewController:picker animated:YES completion:nil];

4. 必须实现的代理函数:

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result

{

[self dismissViewControllerAnimated:YES completion:nil];

}

 

iOS 发短信