当前位置: 首页 > news >正文

前端入门先学什么seo交流群

前端入门先学什么,seo交流群,母婴推广网站,什么网站做淘宝素材比较好这个 资料有些老了 。部分东西还时可以凑合用。 原文出自 http://blog.sina.com.cn/s/blog_68eb52b301013x7n.html iphone如许app读取通讯录信息,读取通讯录信息时需要加载AddressBookUI 和AddressBook两个包,具体实现方法如下ABAddressBookRef addressB…

这个 资料有些老了 。部分东西还时可以凑合用。

原文出自 http://blog.sina.com.cn/s/blog_68eb52b301013x7n.html

iphone如许app读取通讯录信息,读取通讯录信息时需要加载AddressBookUI 和AddressBook两个包,具体实现方法如下

ABAddressBookRef addressBook = ABAddressBookCreate();//定义通讯录名字为addressbook
    CFArrayRef contacts = ABAddressBookCopyArrayOfAllPeople(addressBook);//将通讯录中的信息用数组方式读出
    CFIndex nPeople = ABAddressBookGetPersonCount(addressBook);//获取通讯录中联系人
    
    iphoneContactList = [[NSMutableArray alloc] initWithCapacity:0];
    for (int i = 0; i < nPeople; i++)
    {
        
        IphoneContact * iphoneContact = [[IphoneContact alloc] init];
        
        NSData *imageData = [[[NSData alloc] init]autorelease];
        NSString *address = [[[NSString alloc] init]autorelease];
        
        
        ABRecordRef person = CFArrayGetValueAtIndex(contacts, i);//取出某一个人的信息
       NSInteger lookupforkey =(NSInteger)ABRecordGetRecordID(person);//读取通讯录中联系人的唯一标识
       NSDate * createDate = (NSDate *)ABRecordCopyValue(person, kABPersonCreationDateProperty);// 读取通讯录中联系人的创建日期
        NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
        [formatter setDateFormat:@"yyyy-MM-dd hh:mm:ss"];
        NSString* birthDay = [formatter stringFromDate:createDate];
        [formatter release];
      
        
        
        NSString *createDate1 = [birthDay stringByReplacingOccurrencesOfString:@"-" withString:@""];
        NSString *createDate2 = [createDate1 stringByReplacingOccurrencesOfString:@":" withString:@""];
        NSString *createDate3 = [createDate2 stringByReplacingOccurrencesOfString:@" " withString:@""];
        NSLog(@"1111========%@",createDate3);
        NSLog(@"222222========%@",birthDay);
        NSString *indexInIphone = [NSString stringWithFormat:@"%i",lookupforkey];
        iphoneContact.lookUpKey = [createDate3 stringByAppendingString:indexInIphone];
       //上诉操作是将某个联系人的标识号与创建日期进行组合,得到唯一的标识,是为了当时特殊的需要,一般不会有这种变态应用,这是因为ABRecordGetRecordID在一个手机中是唯一的,即使删掉某一个联系人,这个号也不会在被占用。
        
        
        
              //读取联系人姓名属性
        if (ABRecordCopyValue(person, kABPersonLastNameProperty)&&(ABRecordCopyValue(person, kABPersonFirstNameProperty))== nil) {
            iphoneContact.contactName = (NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);
        }else if (ABRecordCopyValue(person, kABPersonLastNameProperty) == nil&&(ABRecordCopyValue(person, kABPersonFirstNameProperty))){
            iphoneContact.contactName = (NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
        }else if (ABRecordCopyValue(person, kABPersonLastNameProperty)&&(ABRecordCopyValue(person, kABPersonFirstNameProperty))){
            
            NSString *first =(NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
            NSString *last = (NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);
            iphoneContact.contactName = [NSString stringWithFormat:@"%@%@",last,first];
        }                     
         //读取联系人姓名的第一个汉语拼音,用于排序,调用此方法需要在程序中加载pingyin.h pingyin.c,如有需要请给我联系。     
        iphoneContact.pinyin =[[NSString stringWithFormat:@"%c",pinyinFirstLetter([iphoneContact.contactName characterAtIndex:0])] uppercaseString];
        
        
        //读取联系人公司信息                    
        
        iphoneContact.contactCompany = (NSString *)ABRecordCopyValue(person, kABPersonOrganizationProperty);
        
        //读取联系人工作
        iphoneContact.contactJob = (NSString *)ABRecordCopyValue(person, kABPersonJobTitleProperty);
        
        
        
        
        //读取联系人email信息,email有好几种,比如工作邮箱,家庭邮箱,通过ABMultiValueCopyLabelAtIndex 属性来判断,下面给出了例子                
        ABMultiValueRef emailForWORK = ABRecordCopyValue(person, kABPersonEmailProperty);
        if ((emailForWORK != nil)&&ABMultiValueGetCount(emailForWORK)>0) {
            
            for (int k = 0; k < ABMultiValueGetCount(emailForWORK); k++) {
                NSString * aEmail = (NSString *)ABMultiValueCopyValueAtIndex(emailForWORK, k);
                NSString * aEmailLabel = (NSString *)ABMultiValueCopyLabelAtIndex(emailForWORK, k);
                
                if ([aEmailLabel isEqualToString:@"_$!<Work>!$_"]) {
                    iphoneContact.contactEmail = aEmail;
                }       
            }
        }
        
        
        //读取通信地址信息,在ios中国家,省份,城市,区,街道,号都是单独存储的,需要单独读取然后在组合(根据需要)
        ABMultiValueRef addressTotal = ABRecordCopyValue(person, kABPersonAddressProperty);
        if (addressTotal) {
            
            int count = ABMultiValueGetCount(addressTotal);    
            
            for(int j = 0; j < count; j++)
            {
                
                NSDictionary* personaddress =(NSDictionary*) ABMultiValueCopyValueAtIndex(addressTotal, j);        
                NSString* country = [personaddress valueForKey:(NSString *)kABPersonAddressCountryKey];
                if(country != nil)
                    address = [NSString stringWithFormat:@"%@",country];
                NSString* city = [personaddress valueForKey:(NSString *)kABPersonAddressCityKey];
                if(city != nil)
                    address = [address stringByAppendingFormat:@"%@",city];
                NSString* state = [personaddress valueForKey:(NSString *)kABPersonAddressStateKey];
                if(state != nil)
                    address = [address stringByAppendingFormat:@"%@",state];
                NSString* street = [personaddress valueForKey:(NSString *)kABPersonAddressStreetKey];
                if(street != nil)
                    address = [address stringByAppendingFormat:@"%@",street];
                 
            }  
            
            iphoneContact.contactAdress = address;
        }
        
        
        
        
        //读取电话信息,和emial类似,也分为工作电话,家庭电话,工作传真,家庭传真。。。。
        
        ABMultiValueRef phone = ABRecordCopyValue(person, kABPersonPhoneProperty);
        
        if ((phone != nil)&&ABMultiValueGetCount(phone)>0) {
            
            for (int m = 0; m < ABMultiValueGetCount(phone); m++) {
                NSString * aPhone = [(NSString *)ABMultiValueCopyValueAtIndex(phone, m) autorelease];
                NSString * aLabel = [(NSString *)ABMultiValueCopyLabelAtIndex(phone, m) autorelease];
                
                if ([aLabel isEqualToString:@"_$!<Mobile>!$_"]) {
                    iphoneContact.contactMobile= aPhone;
                    
                }
                
                if ([aLabel isEqualToString:@"_$!<WorkFAX>!$_"]) {
                    iphoneContact.contactFax = aPhone;
                }
                
                if ([aLabel isEqualToString:@"_$!<Work>!$_"]) {
                    iphoneContact.contactTelephone= aPhone;
                }       
            }
        }
        
        
        
        
        //读取照片信息
        imageData = (NSData *)ABPersonCopyImageData(person);
        UIImage *myImage = [UIImage imageWithData:imageData];
        CGSize newSize = CGSizeMake(55, 55);
        UIGraphicsBeginImageContext(newSize);
        [myImage drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
        UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();//上诉代码实现图片压缩,可根据需要选择,现在是压缩到55*55
        
        imageData = UIImagePNGRepresentation(newImage);
        
        if (imageData) {
            NSData * BimageData = [GTMBase64 encodeData:imageData];
            iphoneContact.headImage= [[NSString alloc] initWithData:BimageData encoding:NSUTF8StringEncoding];
        }
               
        iphoneContact.isSelected = NO;
        [iphoneContactList addObject:iphoneContact];  //将读取的某一个人信息放到我们自定义的可变数组中        
        
    }

转载于:https://www.cnblogs.com/wqddy/p/3363201.html

http://www.lbrq.cn/news/2764549.html

相关文章:

  • 做好政府门户网站的建设百度排名点击
  • 网红营销模式分析英文网站seo
  • 计算机网站建设开题报告如何自己建设网站
  • 求个没封的a站yw1129cm苏州推广排名
  • 网站 开发流程国内最新消息
  • 外贸soho怎么建网站廊坊seo快速排名
  • 广州大型网站建设公司排名全网整合营销推广系统
  • 建设网站公司哪家好软件网站排行榜
  • 深圳企业网站建设费用温州seo招聘
  • 沈阳市网站建设哪里的公司比较好线上营销策划案例
  • dedecms能做什么网站微信引流推广精准粉
  • 静态网站作品怎么做网络营销推广啊
  • 网站建设公司网站定制开发网站怎么推广
  • 无锡优化网站公司百度合伙人答题兼职赚钱
  • wordpress的xmlrpc长沙优化科技有限公司
  • 苏州模板做网站官网整站优化
  • 九江建网站公司有哪些免费的关键词优化软件
  • 域名网站平台网站设计公司怎么样
  • 网站服务公司代买空间有无义务软文代写接单平台
  • 金融公司网站制作免费建站哪个网站最好
  • 自己网站建设多少钱站长资源平台
  • 网站布局f网络营销策略
  • 西安手机网站制作公司北京、广州最新发布
  • 网站建设公司兴田德润实惠外贸推广是做什么的
  • 巨野住房和城乡建设局网站短视频精准获客系统
  • 做3d图的网站ip域名解析查询
  • 新建的网站如何做seo百度输入法免费下载
  • 网站开发需要哪些证书高端网站建设公司排行
  • 用wordpress建的大部网络推广优化工具
  • 网站开发商换了武汉网络推广公司排名
  • Django前后端交互实现用户登录功能
  • 云原生俱乐部-RH134知识点总结(2)
  • metasploit 框架安装更新遇到无法下载问题如何解决
  • Spark03-RDD02-常用的Action算子
  • 零墨云A4mini打印机设置电脑通过局域网络进行打印
  • JetPack系列教程(八):PDF库——让Android应用也能优雅“翻页”