ios 拨打电话

 

            NSString *telString = [[dict objectForKey:@"send_user_info"] objectForKey:@"tel"];
            
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"拨打电话" message:telString preferredStyle:UIAlertControllerStyleActionSheet];
            UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
                NSLog(@"取消");
            }];
            UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:telString]] ;
            }];
            [alert addAction:cancelAction];
            [alert addAction:okAction];
            [self presentViewController:alert animated:YES completion:nil];

 

posted on 2016-08-10 15:50  codemaker313  阅读(155)  评论(0编辑  收藏  举报

导航