美文网首页
iOS中[[UIApplication sharedApplic

iOS中[[UIApplication sharedApplic

作者: 失忆的程序员 | 来源:发表于2018-04-24 10:56 被阅读481次

// 调用自带mail  

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@163.com"]];  

// 调用电话phone  

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8008808888"]]; //退出应用  

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt://8008808888"]];//不退出应用  

// 调用 SMS  

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://800888888"]];  

// 调用自带浏览器 safari  

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.baidu.com"]];  

=================================================================

// 宏定义使用方法  

#define MailSend(email) ([[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"mailto://%@",email]])  

#define PhoneCall(phone) ([[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",phone]])  

#define PhoneCallAuto(phone) ([[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"telprompt://%@",phone]])  

#define SMSSend(phone) ([[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"sms://%@",phone]])  

#define SafariOpen(url) ([[UIApplication sharedApplication] openURL:[NSURL URLWithString:url])  

相关文章

网友评论

      本文标题:iOS中[[UIApplication sharedApplic

      本文链接:https://www.haomeiwen.com/subject/ziidlftx.html