一.跳轉(zhuǎn)到QQ聊天
1.UIWebview方式
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
NSURL *url = [NSURL URLWithString:@"mqq://im/chat?chat_type=wpa&uin=QQ號碼&version=1&src_type=web"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
[self.view addSubview:webView];
2.openURL
NSString *qq=[NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web",@"QQ號碼"];
NSURL *url = [NSURL URLWithString:qq];
[[UIApplication sharedApplication] openURL:url];
二.撥打電話
1.UIWebview方式
NSURL *phoneURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",@"電話號碼"]];
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];// 這個webView只是一個后臺的 但是這個方法是合法的
[webView loadRequest:[NSURLRequest requestWithURL:phoneURL]];
[self.view addSubview:webView];
2.openURL
NSURL *phoneURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",@"電話號碼"]];
[[UIApplication sharedApplication] openURL:phoneURL];