zoukankan      html  css  js  c++  java
  • iphone调用系统电话、浏览器、地图、邮件等

    URL :http://helloios.diandian.com/post/2011-10-31/6387190

    iphone调用系统电话、浏览器、地图、邮件等

    openURL的使用方法:[[UIApplication sharedApplication] openURL:[NSURL URLWithString:appString]];
    其中系统的appString有:
    1.Map http://maps.google.com/maps?q=Shanghai 
    2.Email mailto://myname@google.com 
    3.Tel tel://10086 
    4.Msg sms://10086 


    openURL能帮助你运行Maps,SMS,Browser,Phone甚至其他的应用程序。这是iPhone开发中我经常需要用到的一段代码,它仅仅只有一行而已。

    //打开地图

    - (IBAction)openMaps {
    NSString*addressText = @"beijing"; //@"1Infinite Loop, Cupertino, CA 95014"; 
    addressText =[addressText stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]; 
    NSString*urlText = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@",addressText]; 
    NSLog(@"urlText=============== %@", urlText); 
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];
    }

    //打开mail

    - (IBAction)openEmail { 

    [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"mailto://devprograms@apple.com"]];

     }

     

    //拨打电话 

    - (IBAction)openPhone {

     [[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"tel://8004664411"]]; 

    }

     

    //打开短信

    - (IBAction)openSms { 

    [[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"sms://466453"]];

    }


    //打开浏览器

    -(IBAction)openBrowser { 

    [[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"http://itunesconnect.apple.com"]]; 

    }

  • 相关阅读:
    ADHOC Report 配置
    html tags
    Stingray验证机制
    常用jQuery知识
    Communication API
    stingray前端架构总体设计及运行过程
    REP report开发技巧
    WorkFlow业务介绍
    MySQL auto_increment初始值设置
    SQL Server中order by的使用,我们来填坑
  • 原文地址:https://www.cnblogs.com/xingchen/p/2445158.html
Copyright © 2011-2022 走看看