实现代码如下:

//拨打电话
-(void)call{    
    UIAlertView * alertView = [[UIAlertView alloc] init];    
    alertView.title = @"确定拨打客服电话?";    
    alertView.message = @"4000-198-716";    
    alertView.delegate = self;    
    [alertView addButtonWithTitle:@"确定"];    
    [alertView addButtonWithTitle:@"取消"];    
    [alertView show];
}
-(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{    
    if (buttonIndex == 0) {        
        NSURL * url = [NSURL URLWithString:@"tel:4000198716"];        
        if ([[UIApplication sharedApplication] canOpenURL:url]) {                    
            [[UIApplication sharedApplication] openURL:url];        
        } else{            
            [MyUtil showTipText:@"您的设备不支持拨打电话"];        
        }    
    }
}

ShevaKuilin
388 声望32 粉丝

世间好物不坚牢,彩云易碎琉璃脆。