iOS中[[UIApplication sharedApplic

2018-04-24  本文已影响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])  

上一篇 下一篇

猜你喜欢

热点阅读