单击iPhone应用程序中的按钮可显示“拨号”屏幕

时间:2012-11-02 19:49:09

标签: ios

我的应用程序中有一个要求是 - 在点击按钮时我们必须使拨号屏幕(呼叫屏幕)显示为下一个视图。这可能吗?请告诉我怎样才能这样做?

3 个答案:

答案 0 :(得分:2)

无法将拨号屏幕打开为新视图。您只能将程序保留并打开默认的iphone对话框屏幕作为新进程(此时您的应用程序将在后台运行)。为此,请使用此代码拨打号码:

NSURL *phoneURL = [NSURL URLWithString:@"tel:12342333"];
[[UIApplication sharedApplication] openURL:phoneURL]]; 

答案 1 :(得分:0)

例如,在您的操作按钮栏中:

NSMutableString *phone = [[@"+ 12 34 567 89 01" mutableCopy] autorelease];
[phone replaceOccurrencesOfString:@" " 
                       withString:@"" 
                          options:NSLiteralSearch 
                            range:NSMakeRange(0, [phone length])];
[phone replaceOccurrencesOfString:@"(" 
                       withString:@"" 
                          options:NSLiteralSearch 
                            range:NSMakeRange(0, [phone length])];
[phone replaceOccurrencesOfString:@")" 
                       withString:@"" 
                          options:NSLiteralSearch 
                            range:NSMakeRange(0, [phone length])];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", phone]];
[[UIApplication sharedApplication] openURL:url];

答案 2 :(得分:0)

对于这个问题的进一步读者,iOS中的两个应用程序可以互动tutorial演示了如何使用iOS中的URL方案完成此操作。