你可以试试 :
NSURL *phoneNumberURL = [NSURL URLWithString:@"tel:80001212"];
[[UIApplication sharedApplication] openURL:phoneNumberURL];
Run Code Online (Sandbox Code Playgroud)
小智 6
NSString* phoneNumber=TextFiled Name
NSString *number = [NSString stringWithFormat:@"%@",phoneNumber];
NSURL* callUrl=[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",number]];
//check Call Function available only in iphone
if([[UIApplication sharedApplication] canOpenURL:callUrl])
{
[[UIApplication sharedApplication] openURL:callUrl];
}
else
{
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"ALERT" message:@"This function is only available on the iPhone" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10017 次 |
| 最近记录: |