我需要通过单击按钮以编程方式在我的应用中调用。
为此我找到了这样的代码。
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:1-800-555-1212"]];
在iphone sdk 3.0 和iphone 2.0 中也可以吗
有什么可以帮忙的吗
提前谢谢你。
最佳答案
将电话号码保存在单独的字符串中。
NSString *phoneNumber = @"1-800-555-1212"; // dynamically assigned
NSString *phoneURLString = [NSString stringWithFormat:@"tel:%@", phoneNumber];
NSURL *phoneURL = [NSURL URLWithString:phoneURLString];
[[UIApplication sharedApplication] openURL:phoneURL];
关于iphone - 如何以编程方式调用电话?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8320879/