Giter Site home page Giter Site logo

ljcontactmanager's Introduction

LJContactManager

Version License Platform Language

介绍

LJContanctManager 是一款操作通讯录的类库,iOS 9 之前使用的是 AddressBook 和 AddressBookUI 系统库,iOS 9 之后使用苹果新推出的 Contacts 和 ContactsUI 框架,一行代码搞定通讯录。

安装

CocoaPods

  1. 在 Podfile 中添加 pod 'LJContactManager'
  2. 执行 pod installpod update
  3. 导入 <LJContactManager.h>。

手动安装

  1. 下载 LJContactManager 文件夹内的所有内容。
  2. 将 LJContactManager 内的源文件添加(拖放)到你的工程。
  3. 导入 LJContactManager.h

使用

主要提供以下的方法:

  • 选择联系人
/**
 选择联系人

 @param controller 控制器
 @param completcion 回调
 */
- (void)selectContactAtController:(UIViewController *)controller
                      complection:(void (^)(NSString *name, NSString *phone))completcion;

  • 创建新联系人
/**
 创建新联系人

 @param phoneNum 手机号
 @param controller 当前 Controller
 */
- (void)createNewContactWithPhoneNum:(NSString *)phoneNum controller:(UIViewController *)controller;

  • 添加到现有联系人
/**
 添加到现有联系人

 @param phoneNum 手机号
 @param controller 当前 Controller
 */
- (void)addToExistingContactsWithPhoneNum:(NSString *)phoneNum controller:(UIViewController *)controller;

  • 获取联系人列表(未分组的通讯录)
/**
 获取联系人列表(未分组的通讯录)
 
 @param completcion 回调
 */
- (void)accessContactsComplection:(void (^)(BOOL succeed, NSArray <LJPerson *> *contacts))completcion;

  • 获取联系人列表(已分组的通讯录)
/**
 获取联系人列表(已分组的通讯录)

 @param completcion 回调
 */
- (void)accessSectionContactsComplection:(void (^)(BOOL succeed, NSArray <LJSectionPerson *> *contacts, NSArray <NSString *> *keys))completcion;

  • 通讯录变更回调(未分组的通讯录)
/**
 通讯录变更回调(未分组的通讯录)
 
 @param succeed 是否成功
 @param newContacts  联系人列表(未分组)
 */
typedef void (^LJContactChangeHanlder) (BOOL succeed, NSArray <LJPerson *> *newContacts);
  • 通讯录变更回调(已分组的通讯录)
/**
 通讯录变更回调(已分组的通讯录)
 
 @param succeed 是否成功
 @param newSectionContacts 联系人列表(已分组)
 @param keys 所有联系人的分区标题
 */
typedef void (^LJSectionContactChangeHanlder) (BOOL succeed, NSArray <LJSectionPerson *> *newSectionContacts, NSArray <NSString *> *keys);

系统要求

该项目最低支持 iOS 8.0 和 Xcode 7.0。

相关文章

iOS 通讯录开发的所有姿势

ljcontactmanager's People

Contributors

leejayid avatar yangchao0033 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.