iOS撥打電話
NSMutableString *str=[[NSMutableString alloc]initWithFormat:@"18514697034"];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
message:str
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消"
style:UIAlertActionStyleCancel
handler:^(UIAlertAction *action) {
}];
UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"撥打"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}];
// Add the actions.
[alertController addAction:cancelAction];
[alertController addAction:otherAction];
[self presentViewController:alertController
animated:YES completion:nil];
這種方法應(yīng)該是體驗(yàn)比較好的一種,比較流暢