简体   繁体   English

如何在拨打电话时自定义警报视图

[英]How do I custom the alert view when making a phone call

currently I'm using UIWebView to make phone calls 目前我正在使用UIWebView拨打电话

NSURL *telURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel://123456789"];
[self.callWebview loadRequest:[NSURLRequest requestWithURL:telURL]];

when I touch on a button to make call, an UIAlertView appears and ask for confirmation with title 123456789 当我触摸按钮拨打电话时,会出现UIAlertView并要求确认标题为123456789

How can I change its title and message ? 如何更改标题和消息?

Thanks. 谢谢。

Don't use a UIWebView , just present a UIAlertView to the user asking if he/she want to call. 不要使用UIWebView ,只是向用户询问他/她是否想要打电话的UIAlertView Also there are no // in the tel: scheme, so tel:123456789 is correct. tel: scheme中也没有// ,所以tel:123456789是正确的。

Then just open open the tel: url via [[UIApplication sharedApplication] openURL:telURL] . 然后通过[[UIApplication sharedApplication] openURL:telURL]打开tel: url。

Also do not forget the check whether the users device can make phone calls: 另外不要忘记检查用户设备是否可以拨打电话:

NSURL *telURL = [NSURL URLWithString:@"tel:123456789"];

if ([[UIApplication sharedApplication] canOpenURL:telURL]) {
 // Present the user with the dialog to start the call
} else {
 // inform the user that he/she can't call numbers from their device.
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用自定义警报弹出视图切换警报弹出视图? - How do I switch the Alert Pop-Up View with a custom Alert popup View? 当应用程序处于后台时,如何显示自定义本地通知视图或自定义警报视图? - How can I show a custom Local notification View or an Custom Alert view when app is in Background? 给定一个电话号码,如何在iOS中拨打电话? - Given a phone number, how do I make a phone call in iOS? 使用Enum + Switch处理错误时,如何显示不同的警报视图功能? - How do I display different alert view functionality when doing error handling with Enum + Switch? 更新 @ObservedObject 时如何在视图上调用函数 - How do I call a function on a view when the @ObservedObject is updated 当iOS 7中显示工作表/警报时,如何在自定义控件上将tintColor设置为灰色? - How do I animate tintColor to gray on a custom-drawn control when a sheet/alert is shown in iOS 7? 应用程序处于后台时,是否可以显示自定义本地通知视图或自定义警报视图? - Can I show a custom Local notification View or an Custom Alert view when app is in Background? 如何自定义警报操作表? - How do I do Custom Alert Action Sheet? 如何在按下按钮时使按钮弹出警报视图并返回主视图控制器? - How Do I Make A Button Get An Alert View To Pop Up When Pressed And Go Back To The Main View Controller? 如何在退出视图之前提示警报 - How do I prompt an alert before exiting a View
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM