iphone手机点击链接直接打电话功能

- (IBAction)onPhoneBtnTouched:(id)sender
{
    if (self.restaurant.telphone && [self.restaurant.telphone length]) {
        [UIDevice tellPhoneWithNumber:self.restaurant.telphone];
    }
}
+ (void)tellPhoneWithNumber:(NSString *)phoneNo
{
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",phoneNo]];
    if ([[UIApplication sharedApplication] canOpenURL:url]) {
        if ([self isPhoneNumberAvailable])
        {
            if (!_webView) {
                _webView = [[UIWebView alloc] initWithFrame:CGRectZero];
            }
            [_webView loadRequest:[NSURLRequest requestWithURL:url]];
        }
    }
}

//下面是两个额外的功能

[self.suggestionTextView becomeFirstResponder];//进入页面键盘就出来的效果,把这句放在viewDidLoad中

NSDictionary *parameters=@{@"opinion":feedback, @"email":emailString};//ios6.0 初始化一个字典的简便方法。

猜你喜欢

转载自zhangmingwei.iteye.com/blog/1769612