<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    一點一滴,編程人生

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      69 隨筆 :: 0 文章 :: 25 評論 :: 0 Trackbacks

    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"]]; 

    }

    使用這種方式撥打電話時,當用戶結束通話后,iphone界面會停留在電話界面。
    用如下方式,可以使得用戶結束通話后自動返回到應用:
    UIWebView*callWebview =[[UIWebView alloc] init];
    NSURL *telURL =[NSURL URLWithString:@"tel:10086"];// 貌似tel:// 或者 tel: 都行
    [callWebview loadRequest:[NSURLRequest requestWithURL:telURL]];
    //記得添加到view上
    [self.view addSubview:callWebview];

     還有一種私有方法:(可能不能通過審核)
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt://10086"]];


    //打開短信

    - (IBAction)openSms { 

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

    }


    //打開瀏覽器

    -(IBAction)openBrowser { 

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

    }

    posted on 2012-06-13 17:09 writegull 閱讀(598) 評論(0)  編輯  收藏 所屬分類: iphone
    主站蜘蛛池模板: 国产大片免费网站不卡美女| 国产乱子影视频上线免费观看| 亚洲中文字幕久久无码| 又大又粗又爽a级毛片免费看| a级毛片无码免费真人久久| 亚洲国产成人无码av在线播放| 国产精品自在自线免费观看| 18禁超污无遮挡无码免费网站| 亚洲国产视频网站| 亚洲精品和日本精品| 日本zzzzwww大片免费| 一级黄色免费大片| 亚洲国产片在线观看| 亚洲精品WWW久久久久久| 91久久精品国产免费直播| 午夜不卡AV免费| 亚洲a级片在线观看| 亚洲一区二区三区影院| 在线观看视频免费国语| 国产精品区免费视频| 三级片免费观看久久| 亚洲一区二区三区不卡在线播放| 亚洲综合精品网站| 国内一级一级毛片a免费| 8x网站免费入口在线观看| sihu国产精品永久免费| 亚洲精品永久在线观看| 亚洲自偷自拍另类图片二区| 亚洲男人在线无码视频| 日韩视频免费在线| 久久精品国产免费观看| 黄页免费在线观看| 国产免费牲交视频免费播放| 亚洲精品又粗又大又爽A片| 亚洲成综合人影院在院播放| 亚洲av无码成h人动漫无遮挡| 亚洲精品成人在线| 日本19禁啪啪无遮挡免费动图| 99爱在线精品免费观看| 久久久久久久99精品免费| 三级黄色片免费看|