• Stars
    star
    189
  • Rank 198,189 (Top 5 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A multilingual replacement for ABPeoplePickerNavigationController (address book picker) that supports UILocalized​Indexed​Collation

ZLPeoplePickerViewController

A replacement for ABPeoplePickerNavigationController that supports UILocalized​Indexed​Collation. ZLPeoplePickerViewController was originally created for Talkly.

Why?

ABPeoplePickerNavigationController does not work well with contact names of multiple languages, neither does some address book based app that worths $16 billion. Here are some examples:

And this is how it should have been:

Preview

###Present ABPersonViewController on select ABPersonViewController ###Send group emails on return Group Emails ###Custom Multiple Select Custom Multiple Select

Features

  • Supports multilingual indexing and sorting by implementing UILocalized​Indexed​Collation using LRIndexedCollationWithSearch.
  • Supports searching by name, emails and addresses. The results are displayed using UISearchController in iOS 8.
  • Supports multiple selection.
  • Supports field mask for filtering contacts.
  • Support searching by phone number

CocoaPods

You can install ZLPeoplePickerViewController through CocoaPods adding the following to your Podfile:

pod 'ZLPeoplePickerViewController'

Usage

Check out the demo app for an example.

ZLPeoplePickerViewController can be initialized and pushed to navigation controller in a way similar to ABPeoplePickerNavigationController:

self.peoplePicker = [[ZLPeoplePickerViewController alloc] init];
self.peoplePicker.delegate = self;
[self.navigationController pushViewController:self.peoplePicker animated:YES];

There is also a convenience method for presenting the people picker modally.

self.peoplePicker = [ZLPeoplePickerViewController presentPeoplePickerViewControllerForParentViewController:self];

Loading a large address book may take a long time. Therefore ZLPeoplePickerViewController caches it in memory after initialization. You can further reduce the first-time delay by initializing the address book with the following class method in advance (for instance, in viewDidLoad).

+ (void)initializeAddressBook;

ZLPeoplePickerViewController uses the fieldMask property to filter contacts, graying out those that have missing information. Currently supported fields inlucde emails, photo and addresses.

@property (nonatomic) ZLContactField filedMask;

The numberOfSelectedPeople property controls the multiple selection behavior. It indicates the maximum number of people the picker can select at a time.

@property (nonatomic) ZLNumSelection numberOfSelectedPeople;

ZLPeoplePickerViewController can have an optional delegate to receive callback.

- (void)peoplePickerViewController:(ZLPeoplePickerViewController *)peoplePicker didSelectPerson:(NSNumber *)recordId {
  // show an ABPersonViewController
  [self showPersonViewController:[recordId intValue] onNavigationController:peoplePicker.navigationController];
}
- (void)peoplePickerViewController:(ZLPeoplePickerViewController *)peoplePicker didReturnWithSelectedPeople:(NSArray *)people {
  // people will be empty if no person is selected
  if (!people || people.count==0) {return;}
  [self presentViewController: [self alertControllerWithTitle:@"Return with selected people:" Message:[[self firstNameForPeople:people] componentsJoinedByString:@", "]] animated:YES completion:nil];
}
- (void)newPersonViewControllerDidCompleteWithNewPerson:(nullable ABRecordRef)person {
    NSLog(@"Added a new person");
}

Dependencies

ZLPeoplePickerViewController uses APAddressBook internally for accessing address book. It requires APAddressBook.

Requirements

  • iOS 8 or higher.
  • Automatic Reference Counting (ARC).

License

ZLPeoplePickerViewController is available under MIT license. See the LICENSE file for more info.

More Repositories

1

ZLSwipeableView

A simple view for building card like interface inspired by Tinder and Potluck.
Objective-C
2,828
star
2

ZLSwipeableViewSwift

A simple view for building card like interface inspired by Tinder and Potluck.
Swift
2,235
star
3

ZLBalancedFlowLayout

A UICollectionViewFlowLayout subclass that scales items to take up space, optimized for large item set, inspired by NHBalancedFlowLayout.
Swift
309
star
4

ZLSinusWaveView

A Siri like voice visualization view using EZAudio. Modified from SISinusWaveView for iOS.
Objective-C
283
star
5

ZLMusicFlowWaveView

A ZLSinusWaveView subclass inspired by 乐流/MusicFlow
Objective-C
202
star
6

ZLHistogramAudioPlot

A hardware-accelerated audio visualization view using EZAudio, inspired by AudioCopy.
Objective-C
185
star
7

UIColor-ChineseTraditionalColors

A swift extension that extends UIColor with a list of Chinese traditional colors
Swift
132
star
8

AsyncTask

An asynchronous programming library for Swift
Swift
130
star
9

react-webgl-globe-basic-example

WebGL Globe basic example in react
JavaScript
70
star
10

Async

Async, await control flow for Swift.
Swift
69
star
11

Algorithms

Answers to LeetCode questions in Swift and JavaScript
Swift
52
star
12

ReactiveUI

A lightweight replacement for target action with closures, modified from Scream.swift.
Swift
51
star
13

Emoticon

An Emoticon Keyboard
Swift
22
star
14

wwdc

WWDC 2015 Student Scholarship App
Swift
6
star
15

printf

A web based visualizer for printf format string
JavaScript
6
star
16

YelpAPI

Yelp API in Swift
Swift
5
star
17

TicketsTonight

UCLA CS130 Fall 2014 Class Project
Objective-C
4
star
18

AlamofireAsync

Async extension for Alamofire
Swift
3
star
19

DongerListKeyboard

Experimenting with iOS 8 keyboard in swift
Objective-C
3
star
20

JSTester

A simple structure tester for javascript programs.
JavaScript
1
star
21

librarymanagement

Python
1
star
22

frappe_app_template

1
star