首页 > 其他 > 详细

tel

时间:2015-03-16 19:17:27      阅读:305      评论:0      收藏:0      [点我收藏+]

//
//  JZLTel.m
//  JZLIntegrationDemo
//
//  Created by 微指 on 15/3/16.
//  Copyright (c) 2015年 JZL. All rights reserved.
//

#import "JZLTel.h"

@implementation JZLTel

/*

#pragma mark - 打电话
-(void)callButtonAction
{
    
    NSString * phone1 = [self.phones objectAtIndex:0];
    NSString * phone2 = [self.phones objectAtIndex:1];
    NSString * name = self.shopname;
    NSMutableSet * phones = [NSMutableSet set];
    
    if (![phone1 isEqualToString:@""] && phone1) {
        
        [phones addObject:phone1];
    }
    
    if (![phone2 isEqualToString:@""] && phone2) {
        
        [phones addObject:phone2];
    }
    
    NSArray * phonesArray = [phones allObjects];
    if (phonesArray.count>1) {
        
        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"呼叫"
                                                         message:name
                                                        delegate:self
                                               cancelButtonTitle:@"取消"
                                               otherButtonTitles:nil];
        
        alert.tag = 500;
        
        for (int i=0; i<phonesArray.count; i++) {
            
            [alert addButtonWithTitle:[phonesArray objectAtIndex:i]];
        }
        [alert show];
        [alert release];
        
    } else if (phonesArray.count == 1) {
        
        UIWebView *callWebView = [[UIWebView alloc] init];
        NSURL *telURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",[phonesArray objectAtIndex:0]]];
        [callWebView loadRequest:[NSURLRequest requestWithURL:telURL]];
        [self.view addSubview:callWebView];
        [callWebView release];
    }
    
}

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex != 0) {
        
        NSString * title = [alertView buttonTitleAtIndex:buttonIndex];
        NSString * str = [NSString stringWithFormat:@"tel:%@",title];
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
    }
}
 */

@end

tel

原文:http://www.cnblogs.com/jzlblog/p/4342497.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!