发送短信,拨打电话,打开qq

时间:2022-11-10 18:55:16
1.0 拨打电话
 
    //    1,这种方法,打完电话后还会回到原来的程序,也会弹出提示,推荐这种
        NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"13691427788"];
        UIWebView * callWebview = [[UIWebView alloc] init];
        [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
        [self.view addSubview:callWebview];
   
   
    //    2,这种方法也会回去到原来的程序里(注意这里的telprompt),也会弹出提示
    NSMutableString * str1 =[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"13691427788"];
    //            NSLog(@"str======%@",str);
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str1]];
 
2.0 发送短信
 
3.0 打开qq
 
    3.1 是否安装qq
    BOOL isSetQQ =  [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"mqq://com.tencent.mqq"]];
    3.2 跳转qq
    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
    NSString *qqStr = [NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web",self.headerModel.qq];
    NSURL *url = [NSURL URLWithString:qqStr];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    webView.delegate = self;
    [webView loadRequest:request];
    [self.view addSubview:webView];