//联系人:石虎QQ: 1224614774昵称:嗡嘛呢叭咪哄
QQ群:807236138 群称:iOS 技术交流学习群
/**
注意:打电话、发短信、发邮箱 、跳转网站 功能(系统方法)---->要真机才有效果
*/
1.简单实现效果图:
2.实现代码:
@implementationViewController
//打电话
- (IBAction)makePhone:(id)sender {
NSString*phoneNum =self.phoneTF.text;
NSString*urlStr = [NSStringstringWithFormat:@"tel://%@",phoneNum];
NSURL*url = [NSURLURLWithString:urlStr];
//调用系统内置应用拨打电话
[[UIApplicationsharedApplication]openURL:url];
}
//发信息
- (IBAction)sendMessage:(id)sender {
NSString*urlStr = [NSStringstringWithFormat:@"sms://%@",self.phoneTF.text];
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:urlStr]];
}
//发邮箱
- (IBAction)sendEmail:(id)sender {
NSString*mailStr = [NSStringstringWithFormat:@"mailto://%@",self.emailTF.text];
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:mailStr]];
}
//进入网站
- (IBAction)gotoURL:(id)sender {
NSURL*url = [NSURLURLWithString:self.phoneTF.text];
[[UIApplicationsharedApplication]openURL:url];
}
@end
谢谢!!!