iOS 從app跳轉到Safari、從app打開電話呼叫


1.從app跳轉到Safari

1 NSString* strIdentifier = @"http://www.ybyb.com";
2             BOOL isExsit = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:strIdentifier]];
3             if(isExsit) {
4                 NSLog(@"App %@ installed", strIdentifier);
5                 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:strIdentifier]];
6             }

 

2.從app打開電話呼叫

 1  NSString *phoneNum = @"10086";// 電話號碼
 2         
 3         UIWebView *phoneCallWebView;
 4         NSURL *phoneURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",phoneNum]];
 5          if ( !phoneCallWebView ) {
 6         phoneCallWebView = [[UIWebView alloc] initWithFrame:CGRectZero];// 這個webView只是一個后台的View 不需要add到頁面上來
 7             
 8              }
 9         [phoneCallWebView loadRequest:[NSURLRequest requestWithURL:phoneURL]];
10         
11         [self.view addSubview:phoneCallWebView];

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM