iOS开发中使app获取本机通讯录的实现代码实例

2020-01-14 19:55:24刘景俊

    cell.detailTextLabel.text = book.tel;
 
    return cell;
}


列表效果

 

iOS开发中使app获取本机通讯录的实现代码实例

PS:通讯录中电话号码中的"-"可以在存入数组之前进行处理,属于NSString处理的范畴,解决办法有很多种,本文不多加说明

四、删除通讯录数据

复制代码
<span style="white-space:pre">    </span>ABRecordRef person = objc_unretainedPointer([myContacts objectAtIndex:indexPath.row]);  
        CFErrorRef *error;  
        ABAddressBookRemoveRecord(addressBook, person, error);  
        ABAddressBookSave(addressBook, error);  
        myContacts = nil;  
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];    

注:相关教程知识阅读请移步到IOS开发频道。