`
zjjzmw1
  • 浏览: 1352818 次
  • 性别: Icon_minigender_1
  • 来自: 开封
社区版块
存档分类
最新评论

[UIApplication sharedApplication] openURL 转载

    博客分类:
  • iOS
阅读更多
引用地址:http://www.cocoachina.com/bbs/read.php?tid=73570&page=3
openURL能帮助你运行Maps,SMS,Browser,Phone甚至其他的应用程序。这是Iphone开发中我经常需要用到的一段代码,它仅仅只有一行而已。
- (IBAction)openMaps {
    //打开地图
   NSString*addressText = @"beijing";
    //@"1Infinite Loop, Cupertino, CA 95014";
   addressText =[addressTextstringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
   NSString*urlText = [NSStringstringWithFormat:@"http://maps.google.com/maps?q=%@",addressText];
   NSLog(@"urlText=============== %@", urlText);
   [[UIApplicati*****haredApplication] openURL:[NSURL URLWithString:urlText]];
}

- (IBAction)openEmail {
     //打开mail // Fire off an email to apple support
      [[UIApplication sharedApplication]openURL:[NSURL   URLWithString:@"mailto://devprograms@apple.com"]];
}

- (IBAction)openPhone {
 
    //拨打电话
    // CallGoogle 411
    [[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"tel://8004664411"]];
}

- (IBAction)openSms {
    //打开短信
     // Text toGoogle SMS
    [[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"sms://466453"]];
}

-(IBAction)openBrowser {
    //打开浏览器
    // Lanuch any iPhone developers fav site
     [[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"http://itunesconnect.apple.com"]];
}
分享到:
评论

相关推荐

    iOS从App跳转至系统设置菜单各功能项的编写方法讲解

    跳到系统设置里的WiFi界面 info里面设置: 在项目中的info.plist中添加 URL types 并... [[UIApplication sharedApplication] openURL:url]; } 定位服务 定位服务有很多APP都有,如果用户关闭了定位,那么,我们在APP

    ios-一行代码集成启动页广告图,支持Gif。.zip

    代码集成支持Block、Delegate: //设置启动页广告图片的url NSString *imgUrlString =@""; //初始化启动页广告(初始化后,自动添加... [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; };

    IOS 开发调用打电话,发短信

     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@tel://8008808888]];  iOS应用内拨打电话结束后返回应用  一般在应用中拨打电话的方式是:  [[UIApplication sharedApplication] ...

    iOS 拨打电话代码的三种方式

    1,这种方式,拨打完电话回不到...[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]]; 2,这种方式,打完电话后还会回到原来的程序,也会弹出提示,一般用这种 NSMutableString * str=[[NSMut

    SendMsgMaster

    [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"sms://13888888888"]]; ###程序内调用系统发短信 #####1)导入MessageUI.framework,并引入头文件: #import #####2)实现代理方法...

    iOS发送短信功能的实现代码

    发短信的功能对于一个需要渠道扩展的APP来说,必不可少。但是,当第一次看到这个需求时,我却一脸懵逼,因为之前并...[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@sms://800888]]; 但是,这段

    IOS 开发中发送e-mail的几种方法总结

    iOS系统框架提供的两种发送Email的方法  1、使用openURL来实现发邮件的功能:  NSString *url = [NSString ...[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]]; 缺点很明显,

    两种iOS调用系统发短信的方法

    [[UIApplication sharedApplication]openURL:url]; 二、程序内调用系统发短信 这种方法有一个好处就是用户发短信之后还可以回到App. 首先要导入MessageUI.framework,并引入头文件: #import 然后要遵循代理...

    StatusBarKit:自定义您的状态栏,例如iOS 9

    StatusBarKit 自定义您的状态栏,例如iOS 9。 ...用法 import StatusBarKit ... UIApplication. sharedApplication (). openURL ( NSURL ( string : " http://yahoo.co.jp " ) ! ) } parameter. rightItem = Sta

    sugarcube:一些糖为您的可可粉。 RubyMotion助手

    UIApplication.sharedApplication.openURL(NSURL.URLWithString(url)) 怎么样: url.nsurl.open 免责声明 您可能会不喜欢SugarCube 。 很好! 有些人在咖啡中加牛奶,有些人则加糖。 如果您能想象到,有些疯狂的...

    UIWebView的使用代码

    sharedApplication] openURL:[request URL]]; return NO; } return YES; } 新建MyWebViewDelegate对象,并赋值给webView的delegate属性 参见:UIWebView open links in Safari 禁用页面滚动弹跳 之前...

Global site tag (gtag.js) - Google Analytics