【问题标题】:Detecting the user's choice when he sees the tel link popup当他看到电话链接弹出时检测用户的选择
【发布时间】:2011-07-30 19:47:27
【问题描述】:

我想知道用户何时真正从我的应用程序 (UIWebView) 发出呼叫,而不仅仅是点击电话号码。

当用户在我的应用程序中按下电话链接后收到呼叫/取消弹出窗口时,如何获取用户选择的结果?

【问题讨论】:

    标签: iphone popup tel


    【解决方案1】:

    Opening tel: links from UIWebView 上有一些关于此的信息。

    工作原理和您想要什么

    操作系统不会为您显示呼叫/取消警报对话框。那取决于你。它出现在 Safari 中是因为 Safari 应用程序的 shouldStartLoadWithRequest 方法无疑会通过显示 UIAlertView 来响应 tel: 方案。 if ([url.scheme isEqualToString:@"tel"]) 的条件应该在“是”时触发带有呼叫和取消按钮的 UIAlertView。在 Call 时,您将告诉 sharedApplication 打开 URL;在取消时,您将不会发出呼叫,并且您还希望返回 NO,因此您的应用不会尝试 loadWithRequest

    代码示例:

     - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
                if (buttonIndex == 1) {
               //OK clicked
              } else {
        }
    }
     
    - (void) _showAlert:(NSString*)title
    {
        UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title message:@"Check your networking configuration." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alertView show];
        [alertView release];
    }
    

    希望这对您有所帮助。

    最好的问候

    莱纳斯

    【讨论】:

      猜你喜欢
      • 2012-07-10
      • 1970-01-01
      • 2010-12-27
      • 1970-01-01
      • 1970-01-01
      • 2011-05-30
      • 2011-09-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多