//我们应用中也是常常会用到这些应用,这里说一些常用且好理解的方法!
#import "NewViewController.h"
#import <MessageUI/MessageUI.h>
@interface NewViewController ()<MFMailComposeViewControllerDelegate,MFMessageComposeViewControllerDelegate>//邮件代理 短信代理 这两个主要是用户操作回调
@end
@implementation NewViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSArray *arr = @[@"电话",@"短信",@"邮件"];
for(int i = 0;i<6;i++)
{
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
btn.frame = CGRectMake(10+i%3*100, 80+i/3*150, 100, 60);
[btn setTitle:arr[i%3] forState:UIControlStateNormal];
[self.view addSubview:btn];
btn.tag = 1000+i;
[btn addTarget:self action:@selector(btnDown:) forControlEvents:UIControlEventTouchUpInside];
}
UILabel *lab = [[UILabel alloc] initWithFrame:CGRectMake(0, 150,
OC_调用系统短信_邮件_电话
最新推荐文章于 2017-12-19 14:58:18 发布
本文介绍了在iOS应用中如何使用Objective-C(OC)调用系统功能,包括直接拨打电话、发送短信和邮件。通过示例代码展示了如何创建按钮触发相应操作,并实现了MFMailComposeViewController和MFMessageComposeViewController的代理方法,以便进行用户操作的回调和状态监控。
摘要由CSDN通过智能技术生成