【发布时间】:2012-02-17 20:59:27
【问题描述】:
我在我的应用中创建了一个选项卡,用户可以在其中直接从应用内调用客户端。
但我不会显示他的号码,我想显示:“你想给客户打电话吗?”而不是“你想拨打 000-000-000”
我在另一个应用程序中看到了这个解决方案,但不知道如何做到这一点。
【问题讨论】:
我在我的应用中创建了一个选项卡,用户可以在其中直接从应用内调用客户端。
但我不会显示他的号码,我想显示:“你想给客户打电话吗?”而不是“你想拨打 000-000-000”
我在另一个应用程序中看到了这个解决方案,但不知道如何做到这一点。
【问题讨论】:
openURL 调用不会自动提示用户输入任何内容。
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:7205551212"]];
与用户确认是一种很好的做法,但消息由您决定。要显示警报,请执行以下操作:
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Confirmation" message:@"Do you want to call Client?" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alertView show];
[alertView release];
然后在 UIAlertViewDelegate 方法中拨打实际电话:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 1) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:7205551212"]];
}
}
【讨论】: