<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                電話、短信是手機的基礎功能,iOS中提供了接口,讓我們調用。這篇文章簡單的介紹一下iOS的打電話、發短信在程序中怎么調用。 **1、打電話** ~~~ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://10010"]];//打電話 ~~~ 使用openURL這個API打電話結束后,返回的是系統的撥打電話界面,如何才能返回自己的應用呢?有兩種方法與大家分享。 第一種是用UIWebView加載電話,這種是合法的,可以上App Store的。 代碼如下: ~~~ UIWebView*callWebview =[[UIWebView alloc] init]; NSURL *telURL =[NSURL URLWithString:@"tel:10010"]; [callWebview loadRequest:[NSURLRequest requestWithURL:telURL]]; //記得添加到view上 [self.view addSubview:callWebview]; ~~~ 第二種是私有方法,不能上App Store的(自己沒試過)。? ~~~ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt://10010"]]; ~~~ 上面的代碼只是把第一個方法中的tel為telprompt. **2、發短信** iOS中可以使用兩種方式發送短信,最簡單是使用openURL: ~~~ [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"sms://10010"]];//發短信 ~~~ 上面方式無法指定短信內容,iOS4.0新加入了MFMessageComposeViewController和MFMessageComposeViewControllerDelegate,提供了發送短信的接口,可以像發送郵件那樣不用跳出程序來發送短信. 介紹可參閱[Message UIFramework Reference](http://developer.apple.com/library/ios/#documentation/MessageUI/Reference/MFMessageComposeViewController_class/Reference/Reference.html) ![](https://box.kancloud.cn/2016-01-14_569725c508f9a.jpg) MFMessageComposeViewController提供了操作界面使用前必須檢查canSendText方法,若返回NO則不應將這個controller展現出來,而應該提示用戶不支持發送短信功能. messageComposeDelegate :代理,處理發送結果 recipients ?:收信人 body :短信內容 Frameworks中要引入MessageUI.framework? #import? 添加協議:rollerDelegate> ~~~ #import <MessageUI/MessageUI.h> @interface DemoViewController : UIViewController <MFMessageComposeViewControllerDelegate> @end ~~~ 調用MFMessageComposeViewController,同時實現協議MFMessageComposeViewControllerDelegate。 ~~~ - (void)showMessageView { if( [MFMessageComposeViewController canSendText] ){ MFMessageComposeViewController * controller = [[MFMessageComposeViewController alloc]init]; //autorelease]; controller.recipients = [NSArray arrayWithObject:@"10010"]; controller.body = @"測試發短信"; controller.messageComposeDelegate = self; [self presentModalViewController:controller animated:YES]; [[[[controller viewControllers] lastObject] navigationItem] setTitle:@"測試短信"];//修改短信界面標題 }else{ [self alertWithTitle:@"提示信息" msg:@"設備沒有短信功能"]; } } //MFMessageComposeViewControllerDelegate - (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result{ [controller dismissModalViewControllerAnimated:NO];//關鍵的一句 不能為YES switch ( result ) { case MessageComposeResultCancelled: [self alertWithTitle:@"提示信息" msg:@"發送取消"]; break; case MessageComposeResultFailed:// send failed [self alertWithTitle:@"提示信息" msg:@"發送成功"]; break; case MessageComposeResultSent: [self alertWithTitle:@"提示信息" msg:@"發送失敗"]; break; default: break; } } - (void) alertWithTitle:(NSString *)title msg:(NSString *)msg { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:msg delegate:self cancelButtonTitle:nil otherButtonTitles:@"確定", nil]; [alert show]; } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看