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];          
     }
 

你可能感兴趣的:(Objective-C)