iPhone 代码实现打电话的另一种方式

NSURL  url= [NSURL URLWithString:@"tel:+12125551212"];

     NSString *osVersion = [[UIDevice currentDevice] systemVersion];

     if ([osVersion floatValue] >= 3.1) {
          UIWebView *webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
          [webview loadRequest:[NSURLRequest requestWithURL:url]];

          // Assume we are in a view controller and have access to self.view
          [self.view addSubview:webview];
          [webview release];
     }
     else {
          // On 3.0 and below, dial as usual
          [[UIApplication sharedApplication] openURL: url];          
     }
 

猜你喜欢

转载自sech.iteye.com/blog/1704898