Repository: zhxnlai/ZLPeoplePickerViewController Branch: master Commit: 8e8e1bb12a39 Files: 31 Total size: 101.3 KB Directory structure: gitextract_rilq1e4f/ ├── .gitignore ├── LICENSE ├── README.md ├── ZLPeoplePickerViewController/ │ ├── Internal/ │ │ ├── APContact+Sorting.h │ │ ├── APContact+Sorting.m │ │ ├── LRIndexedCollationWithSearch.h │ │ ├── LRIndexedCollationWithSearch.m │ │ ├── ZLAddressBook.h │ │ ├── ZLAddressBook.m │ │ ├── ZLBaseTableViewController.h │ │ ├── ZLBaseTableViewController.m │ │ ├── ZLResultsTableViewController.h │ │ ├── ZLResultsTableViewController.m │ │ └── ZLTypes.h │ ├── ZLPeoplePickerViewController.h │ └── ZLPeoplePickerViewController.m ├── ZLPeoplePickerViewController.podspec └── ZLPeoplePickerViewControllerDemo/ ├── Podfile ├── ZLPeoplePickerViewControllerDemo/ │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj/ │ │ └── LaunchScreen.xib │ ├── DemoTableViewController.h │ ├── DemoTableViewController.m │ ├── Images.xcassets/ │ │ └── AppIcon.appiconset/ │ │ └── Contents.json │ ├── Info.plist │ └── main.m ├── ZLPeoplePickerViewControllerDemo.xcodeproj/ │ ├── project.pbxproj │ └── project.xcworkspace/ │ └── contents.xcworkspacedata ├── ZLPeoplePickerViewControllerDemo.xcworkspace/ │ └── contents.xcworkspacedata └── ZLPeoplePickerViewControllerDemoTests/ ├── Info.plist └── ZLPeoplePickerViewControllerDemoTests.m ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # Xcode # build/ *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata *.xccheckout *.moved-aside DerivedData *.hmap *.ipa *.xcuserstate # CocoaPods # # We recommend against adding the Pods directory to your .gitignore. However # you should judge for yourself, the pros and cons are mentioned at: # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control # # Pods/ ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2014 Zhixuan Lai Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ ZLPeoplePickerViewController ============================ A replacement for ABPeoplePickerNavigationController that supports UILocalized​Indexed​Collation. ZLPeoplePickerViewController was originally created for [Talkly](http://zhxnlai.github.io/#/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](Previews/personVCPreview.gif) ###Send group emails on return ![Group Emails](Previews/emailsPreview.gif) ###Custom Multiple Select ![Custom Multiple Select](Previews/mulSelectPreview.gif) Features --- - [x] Supports multilingual indexing and sorting by implementing UILocalized​Indexed​Collation using [LRIndexedCollationWithSearch](https://gist.github.com/305676/c128784d22fcf572d3beded690ce84f85449d7c7). - [x] Supports searching by name, emails and addresses. The results are displayed using UISearchController in iOS 8. - [x] Supports multiple selection. - [x] 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](https://github.com/zhxnlai/ZLPeoplePickerViewController/tree/master/ZLPeoplePickerViewControllerDemo) for an example. ZLPeoplePickerViewController can be initialized and pushed to navigation controller in a way similar to ABPeoplePickerNavigationController: ~~~objective-c 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. ~~~objective-c 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`). ~~~objective-c + (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. ~~~objective-c @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. ~~~objective-c @property (nonatomic) ZLNumSelection numberOfSelectedPeople; ~~~ ZLPeoplePickerViewController can have an optional delegate to receive callback. ~~~objective-c - (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](https://github.com/Alterplay/APAddressBook). Requirements --- - iOS 8 or higher. - Automatic Reference Counting (ARC). License --- ZLPeoplePickerViewController is available under MIT license. See the LICENSE file for more info. ================================================ FILE: ZLPeoplePickerViewController/Internal/APContact+Sorting.h ================================================ // // APContact+Sorting.h // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/5/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import @interface APContact (Sorting) //@property (strong,nonatomic) NSArray *santrizedPhones; - (NSString *)firstName; - (NSString *)lastName; - (NSString *)compositeName; - (NSString *)firstNameOrCompositeName; - (NSString *)lastNameOrCompositeName; //- (NSArray *)linkedContacts; @end ================================================ FILE: ZLPeoplePickerViewController/Internal/APContact+Sorting.m ================================================ // // APContact+Sorting.m // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/5/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import "APContact+Sorting.h" @implementation APContact (Sorting) - (NSString *)firstName { return self.name.firstName; } - (NSString *)lastName { return self.name.lastName; } - (NSString *)compositeName { return self.name.compositeName; } - (NSString *)firstNameOrCompositeName { if ([self.name.firstName length] > 0) { return self.name.firstName; } return self.name.compositeName; } - (NSString *)lastNameOrCompositeName { if ([self.name.lastName length] > 0) { return self.name.lastName; } return self.name.compositeName; } - (NSArray *)linkedContacts { return nil; } - (NSArray *)sanitizedPhones { NSMutableArray *mutableArray = [self.phones mutableCopy]; for (int i = 0; i < mutableArray.count; i++) { NSString *phone = mutableArray[i]; NSCharacterSet *setToRemove = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"]; NSCharacterSet *setToKeep = [setToRemove invertedSet]; mutableArray[i] = [[phone componentsSeparatedByCharactersInSet:setToKeep] componentsJoinedByString:@""]; } // NSLog(@"san phones: %@", mutableArray); return [mutableArray copy]; // static dispatch_once_t onceToken; // dispatch_once(&onceToken, ^{ // NSMutableArray *mutableArray = [self.phones mutableCopy]; // for (int i=0;i // // LRSearchableIndexCollation.m // // // Copyright (c) 2010 Luke Redpath // Licensed under the MIT License // #import /* A simple decorator around UILocalizedIndexedCollation that inserts the {{search}} magnifying glass icon into the section index titles and adjusts the section index as necessary to account for the extra index item. Use as a direct replacement for UILocalizedIndexedCollation in indexed table views that have a search interface. */ @interface LRIndexedCollationWithSearch : NSObject @property (nonatomic, readonly) NSArray *sectionTitles; @property (nonatomic, readonly) NSArray *sectionIndexTitles; + (id)currentCollation; - (id)initWithCollation:(UILocalizedIndexedCollation *)collation; - (NSInteger)sectionForObject:(id)object collationStringSelector:(SEL)selector; - (NSInteger)sectionForSectionIndexTitleAtIndex:(NSInteger)indexTitleIndex; - (NSArray *)sortedArrayFromArray:(NSArray *)array collationStringSelector:(SEL)selector; @end ================================================ FILE: ZLPeoplePickerViewController/Internal/LRIndexedCollationWithSearch.m ================================================ // // LRIndexedCollationWithSearch.m // ContactListDemo // // Created by Zhixuan Lai on 9/6/14. // Copyright (c) 2014 Jacky Li. All rights reserved. // #import "LRIndexedCollationWithSearch.h" @implementation LRIndexedCollationWithSearch { UILocalizedIndexedCollation *_collation; } @dynamic sectionTitles; @dynamic sectionIndexTitles; + (id)currentCollation; { UILocalizedIndexedCollation *collation = [UILocalizedIndexedCollation currentCollation]; return [[self alloc] initWithCollation:collation]; } - (id)initWithCollation:(UILocalizedIndexedCollation *)collation; { if (self = [super init]) { _collation = collation; } return self; } #pragma mark - - (NSInteger)sectionForObject:(id)object collationStringSelector:(SEL)selector { return [_collation sectionForObject:object collationStringSelector:selector]; } - (NSInteger)sectionForSectionIndexTitleAtIndex:(NSInteger)indexTitleIndex { if (indexTitleIndex == 0) { return NSNotFound; } return [_collation sectionForSectionIndexTitleAtIndex:indexTitleIndex - 1]; } - (NSArray *)sortedArrayFromArray:(NSArray *)array collationStringSelector:(SEL)selector { return [_collation sortedArrayFromArray:array collationStringSelector:selector]; } #pragma mark - #pragma mark Accessors - (NSArray *)sectionTitles; { return [_collation sectionTitles]; } - (NSArray *)sectionIndexTitles; { return [[NSArray arrayWithObject:UITableViewIndexSearch] arrayByAddingObjectsFromArray:[_collation sectionIndexTitles]]; } @end ================================================ FILE: ZLPeoplePickerViewController/Internal/ZLAddressBook.h ================================================ // // ZLAddressBook.h // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/11/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import extern NSString *const ZLAddressBookDidChangeNotification; @interface ZLAddressBook : NSObject @property (strong, nonatomic, readonly) NSArray *contacts; + (instancetype)sharedInstance; - (void)loadContacts:(void (^)(BOOL succeeded, NSError *error))completionBlock; @end ================================================ FILE: ZLPeoplePickerViewController/Internal/ZLAddressBook.m ================================================ // // ZLAddressBook.m // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/11/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import "ZLAddressBook.h" #import "APAddressBook.h" #import "APContact.h" NSString *const ZLAddressBookDidChangeNotification = @"ZLAddressBookDidChangeNotification"; @interface ZLAddressBook () @property (strong, nonatomic) APAddressBook *addressBook; @property (strong, nonatomic, readwrite) NSArray *contacts; @end @implementation ZLAddressBook + (instancetype)sharedInstance { static dispatch_once_t pred = 0; __strong static id _sharedObject = nil; dispatch_once(&pred, ^{ _sharedObject = [[self alloc] init]; }); return _sharedObject; } - (instancetype)init { self = [super init]; if (self) { [self setup]; } return self; } - (void)setup { self.addressBook = [[APAddressBook alloc] init]; } #pragma mark - APAddressBook - (void)loadContacts:(void (^)(BOOL succeeded, NSError *error))completionBlock { __weak __typeof(self) weakSelf = self; self.addressBook.fieldsMask = APContactFieldDefault | APContactFieldThumbnail | APContactFieldLinkedRecordIDs | APContactFieldEmailsOnly | APContactFieldEmailsWithLabels | APContactFieldAddresses; self.addressBook.filterBlock = ^BOOL(APContact *contact) { return contact.name.compositeName != nil; }; [self.addressBook loadContacts:^(NSArray *contacts, NSError *error) { if (!error) { weakSelf.contacts = contacts; if (completionBlock) { completionBlock(YES, nil); } } else { if (completionBlock) { completionBlock(NO, error); } } }]; [self.addressBook startObserveChangesWithCallback:^{ // [weakSelf reloadData]; [[NSNotificationCenter defaultCenter] postNotificationName:ZLAddressBookDidChangeNotification object:nil]; }]; } @end ================================================ FILE: ZLPeoplePickerViewController/Internal/ZLBaseTableViewController.h ================================================ // // ZLBaseTableViewController.h // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/5/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import #import "ZLTypes.h" @class APContact; static NSString *const kCellIdentifier = @"cellID"; @interface ZLBaseTableViewController : UITableViewController @property (strong, nonatomic) NSMutableArray *partitionedContacts; @property (strong, nonatomic) NSMutableSet *selectedPeople; @property (assign, nonatomic) BOOL shouldHideUnmaskedContacts; @property (nonatomic) ZLContactField fieldMask; - (void)setPartitionedContactsWithContacts:(NSArray *)contacts; - (void)configureCell:(UITableViewCell *)cell forContact:(APContact *)product; - (BOOL)shouldEnableCellforContact:(APContact *)contact; - (APContact *)contactForRowAtIndexPath:(NSIndexPath *)indexPath; @end ================================================ FILE: ZLPeoplePickerViewController/Internal/ZLBaseTableViewController.m ================================================ // // ZLBaseTableViewController.m // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/5/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import "ZLBaseTableViewController.h" #import "LRIndexedCollationWithSearch.h" #import "APContact.h" #import "APContact+Sorting.h" @implementation ZLBaseTableViewController #pragma mark - Properties - (NSMutableArray *)partitionedContacts { if (!_partitionedContacts) { _partitionedContacts = [[self emptyPartitionedArray] mutableCopy]; } return _partitionedContacts; } - (NSMutableSet *)selectedPeople { if (!_selectedPeople) { _selectedPeople = [NSMutableSet set]; } return _selectedPeople; } - (void)setPartitionedContactsWithContacts:(NSArray *)contacts { self.partitionedContacts = [[self emptyPartitionedArray] mutableCopy]; NSMutableSet *allPhoneNumbers = [NSMutableSet set]; for (APContact *contact in contacts) { if ([self shouldHideContact:contact]) { continue; } // only display one linked contacts if(contact.phones && [contact.phones count] > 0 && ![allPhoneNumbers containsObject:contact.phones[0].number]) { [allPhoneNumbers addObject:contact.phones[0].number]; } // add new contact SEL selector = @selector(lastName); if (contact.lastName.length == 0) { selector = @selector(compositeName); } NSInteger index = [[LRIndexedCollationWithSearch currentCollation] sectionForObject:contact collationStringSelector:selector]; // contact.sectionIndex = index; [self.partitionedContacts[index] addObject:contact]; } // sort sections NSUInteger sectionCount = [[[LRIndexedCollationWithSearch currentCollation] sectionTitles] count]; int sectionCountInt = [[NSNumber numberWithUnsignedInteger:sectionCount] intValue]; for (NSInteger i = 0; i < sectionCountInt; i++) { NSArray *section = self.partitionedContacts[i]; NSArray *sortedSectionByLastName = [[LRIndexedCollationWithSearch currentCollation] sortedArrayFromArray:section collationStringSelector:@selector(lastNameOrCompositeName)]; NSMutableArray *sortedSection = [NSMutableArray array]; { NSMutableArray *subSection = [NSMutableArray array]; NSString *currentLastName = [NSString string]; for (int i = 0; i < sortedSectionByLastName.count; i++) { APContact *contact = (APContact *)sortedSectionByLastName[i]; NSString *lastName = [contact lastNameOrCompositeName]; if ([lastName isEqualToString:currentLastName]) { [subSection addObject:contact]; } else { if (subSection.count > 0) { NSArray *sortedSubSectionByFirstName = [[LRIndexedCollationWithSearch currentCollation] sortedArrayFromArray:subSection collationStringSelector: @selector(firstNameOrCompositeName)]; [sortedSection addObjectsFromArray:sortedSubSectionByFirstName]; [subSection removeAllObjects]; } currentLastName = lastName; [subSection addObject:contact]; } } NSArray *sortedSubSectionByFirstName = [ [LRIndexedCollationWithSearch currentCollation] sortedArrayFromArray:subSection collationStringSelector:@selector(firstNameOrCompositeName)]; [sortedSection addObjectsFromArray:sortedSubSectionByFirstName]; } self.partitionedContacts[i] = sortedSection; } } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { if (self.partitionedContacts.count > 0) { return [[[LRIndexedCollationWithSearch currentCollation] sectionTitles] count]; } return 0; } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { if ((NSInteger)[[self.partitionedContacts objectAtIndex:(NSUInteger)section] count] == 0) { return @""; } return [[[LRIndexedCollationWithSearch currentCollation] sectionTitles] objectAtIndex:section]; } - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { return [[LRIndexedCollationWithSearch currentCollation] sectionIndexTitles]; } - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index { NSInteger ret = [[LRIndexedCollationWithSearch currentCollation] sectionForSectionIndexTitleAtIndex:index]; if (ret == NSNotFound) { [self.tableView setContentOffset:CGPointMake(0.0, -self.tableView.contentInset.top)]; } return ret; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return (NSInteger)[ [self.partitionedContacts objectAtIndex:(NSUInteger)section] count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = (UITableViewCell *) [tableView dequeueReusableCellWithIdentifier:kCellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:kCellIdentifier]; // cell.accessoryView = nil; cell.accessoryType = UITableViewCellAccessoryNone; // cell.selectionStyle = UITableViewCellSelectionStyleDefault; } APContact *contact = [self contactForRowAtIndexPath:indexPath]; [self configureCell:cell forContact:contact]; if ([self.selectedPeople containsObject:contact.recordID]) { cell.accessoryType = UITableViewCellAccessoryCheckmark; } else { cell.accessoryType = UITableViewCellAccessoryNone; } return cell; } #pragma mark - () - (void)configureCell:(UITableViewCell *)cell forContact:(APContact *)contact { NSString *stringToHightlight = contact.lastName ? contact.lastName : contact.compositeName; NSRange rangeToHightlight = [contact.compositeName rangeOfString:stringToHightlight]; NSMutableAttributedString *attributedString = [ [NSMutableAttributedString alloc] initWithString:contact.compositeName]; [attributedString beginEditing]; [attributedString addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:18] range:rangeToHightlight]; if (![self shouldEnableCellforContact:contact]) { [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, attributedString.length)]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } [attributedString endEditing]; cell.textLabel.attributedText = attributedString; } - (BOOL)shouldEnableCellforContact:(APContact *)contact { if(self.fieldMask == ZLContactFieldAll) { return YES; } else { return ((self.fieldMask & ZLContactFieldPhones) && contact.phones.count > 0) || ((self.fieldMask & ZLContactFieldEmails) && contact.emails.count > 0) || ((self.fieldMask & ZLContactFieldPhoto) && contact.thumbnail) || ((self.fieldMask & ZLContactFieldAddresses) && contact.addresses.count > 0); } } - (BOOL)shouldHideContact:(APContact *)contact { if (self.shouldHideUnmaskedContacts == NO) { return NO; } if(self.fieldMask == ZLContactFieldAll) { return NO; } else { return ((self.fieldMask & ZLContactFieldPhones) && contact.phones.count == 0) || ((self.fieldMask & ZLContactFieldEmails) && contact.emails.count == 0) || ((self.fieldMask & ZLContactFieldPhoto) && contact.thumbnail == nil) || ((self.fieldMask & ZLContactFieldAddresses) && contact.addresses.count == 0); } } - (APContact *)contactForRowAtIndexPath:(NSIndexPath *)indexPath { return [[self.partitionedContacts objectAtIndex:(NSUInteger)indexPath.section] objectAtIndex:(NSUInteger)indexPath.row]; } - (NSMutableArray *)emptyPartitionedArray { NSUInteger sectionCount = [[[LRIndexedCollationWithSearch currentCollation] sectionTitles] count]; NSMutableArray *sections = [NSMutableArray arrayWithCapacity:sectionCount]; for (int i = 0; i < sectionCount; i++) { [sections addObject:[NSMutableArray array]]; } return sections; } @end ================================================ FILE: ZLPeoplePickerViewController/Internal/ZLResultsTableViewController.h ================================================ // // ZLResultsTableViewController.h // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/5/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import "ZLBaseTableViewController.h" @interface ZLResultsTableViewController : ZLBaseTableViewController @end ================================================ FILE: ZLPeoplePickerViewController/Internal/ZLResultsTableViewController.m ================================================ // // ZLResultsTableViewController.m // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/5/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import "ZLResultsTableViewController.h" #import "APContact.h" @implementation ZLResultsTableViewController @end ================================================ FILE: ZLPeoplePickerViewController/Internal/ZLTypes.h ================================================ // // ZLTypes.h // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/11/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #ifndef ZLPeoplePickerViewControllerDemo_ZLTypes_h #define ZLPeoplePickerViewControllerDemo_ZLTypes_h typedef NS_ENUM(NSUInteger, ZLNumSelection) { ZLNumSelectionNone = 0, ZLNumSelectionMax = NSUIntegerMax }; typedef NS_OPTIONS(NSUInteger, ZLContactField){ ZLContactFieldPhones = 1 << 3, ZLContactFieldEmails = 1 << 4, ZLContactFieldPhoto = 1 << 5, ZLContactFieldAddresses = 1 << 9, ZLContactFieldDefault = ZLContactFieldPhones, ZLContactFieldAll = 0xFFFF}; #endif ================================================ FILE: ZLPeoplePickerViewController/ZLPeoplePickerViewController.h ================================================ // // ZLPeoplePickerViewController.h // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/4/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import #import #import "ZLBaseTableViewController.h" @class ZLPeoplePickerViewController; @protocol ZLPeoplePickerViewControllerDelegate /** * Tells the delegate that the people picker has selected a person. * * @param peoplePicker The people picker object providing this information. * @param recordId The person's recordId in ABAddressBook */ - (void)peoplePickerViewController:(nonnull ZLPeoplePickerViewController *)peoplePicker didSelectPerson:(nonnull NSNumber * )recordId; /** * Tells the delegate that the people picker has returned and, if the type is *multiple, selected contacts. * * @param peoplePicker The people picker object providing this information. * @param people An set of recordIds */ - (void)peoplePickerViewController:(nonnull ZLPeoplePickerViewController *)peoplePicker didReturnWithSelectedPeople:(nonnull NSSet *)people; /** * Tells the delegate that the people picker's ABNewPersonViewController did complete * with a new person (can be NULL) * * @param person A valid person that was saved into the Address Book, otherwise NULL */ -(void)newPersonViewControllerDidCompleteWithNewPerson:(nullable ABRecordRef)person; @end @interface ZLPeoplePickerViewController : ZLBaseTableViewController @property (weak, nonatomic, nullable) id delegate; @property (nonatomic) ZLNumSelection numberOfSelectedPeople; @property (nonatomic, assign) BOOL allowAddPeople; + (void)initializeAddressBook; //- (id)init __attribute__((unavailable("-init is not allowed, use //-initWithType: instead"))); - (nonnull instancetype)initWithStyle:(UITableViewStyle)style __attribute__((unavailable( "-initWithStyle is not allowed, use -init instead"))); + (nonnull instancetype)presentPeoplePickerViewControllerForParentViewController: (nullable __kindof id)parentViewController; @end ================================================ FILE: ZLPeoplePickerViewController/ZLPeoplePickerViewController.m ================================================ // // ZLPeoplePickerViewController.m // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/4/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import "ZLPeoplePickerViewController.h" #import "ZLResultsTableViewController.h" #import #import #import "ZLAddressBook.h" #import "APContact+Sorting.h" @interface ZLPeoplePickerViewController () < ABPeoplePickerNavigationControllerDelegate, ABPersonViewControllerDelegate, ABNewPersonViewControllerDelegate, ABUnknownPersonViewControllerDelegate, UISearchBarDelegate, UISearchControllerDelegate, UISearchResultsUpdating> @property (nonatomic, strong) UISearchController *searchController; @property (nonatomic, strong) ZLResultsTableViewController *resultsTableViewController; // for state restoration @property BOOL searchControllerWasActive; @property BOOL searchControllerSearchFieldWasFirstResponder; @end @implementation ZLPeoplePickerViewController - (instancetype)init { self = [super init]; if (self) { [self setup]; } return self; } - (void)setup { _numberOfSelectedPeople = ZLNumSelectionNone; self.fieldMask = ZLContactFieldDefault; self.allowAddPeople = YES; } + (void)initializeAddressBook { [[ZLAddressBook sharedInstance] loadContacts:nil]; } - (void)viewDidLoad { [super viewDidLoad]; self.resultsTableViewController = [[ZLResultsTableViewController alloc] init]; self.searchController = [[UISearchController alloc] initWithSearchResultsController:self.resultsTableViewController]; self.searchController.searchResultsUpdater = self; [self.searchController.searchBar sizeToFit]; self.tableView.tableHeaderView = self.searchController.searchBar; // we want to be the delegate for our filtered table so // didSelectRowAtIndexPath is called for both tables self.resultsTableViewController.tableView.delegate = self; self.searchController.delegate = self; // self.searchController.dimsBackgroundDuringPresentation = NO; // // default is YES self.searchController.searchBar.delegate = self; // so we can monitor text changes + others // Search is now just presenting a view controller. As such, normal view // controller // presentation semantics apply. Namely that presentation will walk up the // view controller // hierarchy until it finds the root view controller or one that defines a // presentation context. // self.definesPresentationContext = YES; // know where you want UISearchController to be displayed self.refreshControl = [[UIRefreshControl alloc] init]; [self.tableView addSubview:self.refreshControl]; [self.refreshControl addTarget:self action:@selector(refreshControlAction:) forControlEvents:UIControlEventValueChanged]; [self refreshControlAction:self.refreshControl]; // Uncomment the following line to preserve selection between presentations. // self.clearsSelectionOnViewWillAppear = NO; self.navigationItem.title = self.title.length > 0 ? self.title : NSLocalizedString(@"Contacts", nil); if (self.allowAddPeople) { self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(showNewPersonViewController)]; } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addressBookDidChangeNotification:) name:ZLAddressBookDidChangeNotification object:nil]; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; // restore the searchController's active state if (self.searchControllerWasActive) { self.searchController.active = self.searchControllerWasActive; _searchControllerWasActive = NO; if (self.searchControllerSearchFieldWasFirstResponder) { [self.searchController.searchBar becomeFirstResponder]; _searchControllerSearchFieldWasFirstResponder = NO; } } } - (void)didMoveToParentViewController:(UIViewController *)parent { if (![parent isEqual:self.parentViewController]) { [self invokeReturnDelegate]; } } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self name:ZLAddressBookDidChangeNotification object:nil]; } #pragma mark - Action + (instancetype)presentPeoplePickerViewControllerForParentViewController: (nullable __kindof id)parentViewController { UINavigationController *navController = [[UINavigationController alloc] init]; ZLPeoplePickerViewController *peoplePicker = [[ZLPeoplePickerViewController alloc] init]; [navController pushViewController:peoplePicker animated:NO]; peoplePicker.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:peoplePicker action:@selector(doneButtonAction:)]; peoplePicker.delegate = parentViewController; [parentViewController presentViewController:navController animated:YES completion:nil]; return peoplePicker; } - (void)doneButtonAction:(id)sender { [self dismissViewControllerAnimated:YES completion:nil]; [self invokeReturnDelegate]; } - (void)refreshControlAction:(UIRefreshControl *)aRefreshControl { [aRefreshControl beginRefreshing]; [self reloadData:^(BOOL succeeded, NSError *error) { [aRefreshControl endRefreshing]; }]; } - (void)addressBookDidChangeNotification:(NSNotification *)note { [self performSelector:@selector(reloadData) withObject:nil]; } - (void)reloadData { [self reloadData:nil]; } - (void)reloadData:(void (^)(BOOL succeeded, NSError *error))completionBlock { __weak __typeof(self) weakSelf = self; if ([ZLAddressBook sharedInstance].contacts.count > 0) { [weakSelf setPartitionedContactsWithContacts:[ZLAddressBook sharedInstance] .contacts]; [weakSelf.tableView reloadData]; } [[ZLAddressBook sharedInstance] loadContacts:^(BOOL succeeded, NSError *error) { if (!error) { [weakSelf setPartitionedContactsWithContacts: [ZLAddressBook sharedInstance].contacts]; [weakSelf.tableView reloadData]; if (completionBlock) { completionBlock(YES, nil); } } else { if (completionBlock) { completionBlock(NO, nil); } } }]; } #pragma mark - UISearchBarDelegate - (void)searchBarCancelButtonClicked:(UISearchBar *)aSearchBar { [aSearchBar resignFirstResponder]; } - (void)searchBarTextDidBeginEditing:(UISearchBar *)aSearchBar { [aSearchBar setShowsCancelButton:YES animated:YES]; } - (void)searchBarTextDidEndEditing:(UISearchBar *)aSearchBar { [aSearchBar setShowsCancelButton:NO animated:YES]; } #pragma mark - UITableViewDelegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; APContact *contact = [self contactForRowAtIndexPath:indexPath]; if (![tableView isEqual:self.tableView]) { contact = [(ZLResultsTableViewController *) self.searchController.searchResultsController contactForRowAtIndexPath:indexPath]; } if (![self shouldEnableCellforContact:contact]) { return; } if (self.delegate && [self.delegate respondsToSelector:@selector(peoplePickerViewController: didSelectPerson:)]) { [self.delegate peoplePickerViewController:self didSelectPerson:contact.recordID]; } if ([self.selectedPeople containsObject:contact.recordID]) { [self.selectedPeople removeObject:contact.recordID]; } else { if (self.selectedPeople.count < self.numberOfSelectedPeople) { [self.selectedPeople addObject:contact.recordID]; } } // NSLog(@"heree"); [tableView reloadData]; [self.tableView reloadData]; } #pragma mark - UISearchResultsUpdating - (void)updateSearchResultsForSearchController: (UISearchController *)searchController { // update the filtered array based on the search text NSString *searchText = searchController.searchBar.text; NSMutableArray *searchResults = [[self.partitionedContacts valueForKeyPath:@"@unionOfArrays.self"] mutableCopy]; // strip out all the leading and trailing spaces NSString *strippedStr = [searchText stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceCharacterSet]]; // break up the search terms (separated by spaces) NSArray *searchItems = nil; if (strippedStr.length > 0) { searchItems = [strippedStr componentsSeparatedByString:@" "]; } // build all the "AND" expressions for each value in the searchString NSMutableArray *andMatchPredicates = [NSMutableArray array]; for (NSString *searchString in searchItems) { NSMutableArray *searchItemsPredicate = [NSMutableArray array]; // TODO: match phone number matching // name field matching NSPredicate *finalPredicate = [NSPredicate predicateWithFormat:@"compositeName CONTAINS[c] %@", searchString]; [searchItemsPredicate addObject:finalPredicate]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY SELF.emails.address CONTAINS[c] %@", searchString]; [searchItemsPredicate addObject:predicate]; predicate = [NSPredicate predicateWithFormat:@"ANY SELF.addresses.street CONTAINS[c] %@", searchString]; [searchItemsPredicate addObject:predicate]; predicate = [NSPredicate predicateWithFormat:@"ANY SELF.addresses.city CONTAINS[c] %@", searchString]; [searchItemsPredicate addObject:predicate]; predicate = [NSPredicate predicateWithFormat:@"ANY SELF.addresses.zip CONTAINS[c] %@", searchString]; [searchItemsPredicate addObject:predicate]; predicate = [NSPredicate predicateWithFormat:@"ANY SELF.addresses.country CONTAINS[c] %@", searchString]; [searchItemsPredicate addObject:predicate]; predicate = [NSPredicate predicateWithFormat: @"ANY SELF.addresses.countryCode CONTAINS[c] %@", searchString]; [searchItemsPredicate addObject:predicate]; // NSNumberFormatter *numFormatter = [[NSNumberFormatter alloc] // init]; // [numFormatter setNumberStyle:NSNumberFormatterNoStyle]; // NSNumber *targetNumber = [numFormatter // numberFromString:searchString]; // if (targetNumber != nil) { // searchString may not convert // to a number // predicate = [NSPredicate predicateWithFormat:@"ANY // SELF.sanitizePhones CONTAINS[c] %@", searchString]; // [searchItemsPredicate addObject:predicate]; // } // at this OR predicate to our master AND predicate NSCompoundPredicate *orMatchPredicates = (NSCompoundPredicate *)[NSCompoundPredicate orPredicateWithSubpredicates:searchItemsPredicate]; [andMatchPredicates addObject:orMatchPredicates]; } NSCompoundPredicate *finalCompoundPredicate = nil; // match up the fields of the Product object finalCompoundPredicate = (NSCompoundPredicate *) [NSCompoundPredicate andPredicateWithSubpredicates:andMatchPredicates]; searchResults = [[searchResults filteredArrayUsingPredicate:finalCompoundPredicate] mutableCopy]; // hand over the filtered results to our search results table ZLResultsTableViewController *tableController = (ZLResultsTableViewController *) self.searchController.searchResultsController; tableController.fieldMask = self.fieldMask; tableController.selectedPeople = self.selectedPeople; [tableController setPartitionedContactsWithContacts:searchResults]; [tableController.tableView reloadData]; } #pragma mark - ABAdressBookUI #pragma mark Create a new person - (void)showNewPersonViewController { ABNewPersonViewController *picker = [[ABNewPersonViewController alloc] init]; picker.newPersonViewDelegate = self; UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:picker]; [self presentViewController:navigation animated:YES completion:nil]; } #pragma mark ABNewPersonViewControllerDelegate methods // Dismisses the new-person view controller. - (void)newPersonViewController: (ABNewPersonViewController *)newPersonViewController didCompleteWithNewPerson:(ABRecordRef)person { [self dismissViewControllerAnimated:YES completion:NULL]; if (self.delegate && [self.delegate respondsToSelector:@selector(newPersonViewControllerDidCompleteWithNewPerson:)]) { [self.delegate newPersonViewControllerDidCompleteWithNewPerson:person]; } } #pragma mark ABUnknownPersonViewControllerDelegate - (void)unknownPersonViewController:(ABUnknownPersonViewController *)unknownCardViewController didResolveToPerson:(ABRecordRef)person { } #pragma mark ABPersonViewControllerDelegate - (BOOL)personViewController:(ABPersonViewController *)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID)property identifier: (ABMultiValueIdentifier)identifierForValue { return NO; } #pragma mark - () - (void)invokeReturnDelegate { if (self.delegate && [self.delegate respondsToSelector:@selector(peoplePickerViewController: didReturnWithSelectedPeople:)]) { [self.delegate peoplePickerViewController:self didReturnWithSelectedPeople:[self.selectedPeople copy]]; } } @end ================================================ FILE: ZLPeoplePickerViewController.podspec ================================================ Pod::Spec.new do |s| s.name = "ZLPeoplePickerViewController" s.version = "0.2.0" s.summary = "A drop-in contact picker that supports UILocalized​Indexed​Collation." s.description = <<-DESC ZLPeoplePickerViewController is a drop-in contact picker that supports UILocalized​Indexed​Collation. 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. DESC s.homepage = "https://github.com/zhxnlai/ZLPeoplePickerViewController" s.screenshots = "https://raw.githubusercontent.com/zhxnlai/ZLPeoplePickerViewController/master/Previews/personVCPreview.gif", "https://raw.githubusercontent.com/zhxnlai/ZLPeoplePickerViewController/master/Previews/emailsPreview.gif" s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Zhixuan Lai" => "zhxnlai@gmail.com" } s.platform = :ios, "8.0" s.source = { :git => "https://github.com/zhxnlai/ZLPeoplePickerViewController.git", :tag => "0.2.0" } s.source_files = "ZLPeoplePickerViewController", "ZLPeoplePickerViewController/**/*.{h,m}" s.frameworks = "UIKit", "AddressBook", "AddressBookUI" s.requires_arc = true s.dependency "APAddressBook", '0.2.1' end ================================================ FILE: ZLPeoplePickerViewControllerDemo/Podfile ================================================ # Uncomment this line to define a global platform for your project # platform :ios, '6.0' source 'https://github.com/CocoaPods/Specs.git' target 'ZLPeoplePickerViewControllerDemo' do pod 'APAddressBook' end target 'ZLPeoplePickerViewControllerDemoTests' do end ================================================ FILE: ZLPeoplePickerViewControllerDemo/ZLPeoplePickerViewControllerDemo/AppDelegate.h ================================================ // // AppDelegate.h // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/4/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; @end ================================================ FILE: ZLPeoplePickerViewControllerDemo/ZLPeoplePickerViewControllerDemo/AppDelegate.m ================================================ // // AppDelegate.m // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/4/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import "AppDelegate.h" #import "DemoTableViewController.h" @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. DemoTableViewController *homeTVC = [[DemoTableViewController alloc] initWithStyle:UITableViewStyleGrouped]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:homeTVC]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.rootViewController = navController; [self.window makeKeyAndVisible]; return YES; } - (void)applicationWillResignActive:(UIApplication *)application { // Sent when the application is about to move from active to inactive state. // This can occur for certain types of temporary interruptions (such as an // incoming phone call or SMS message) or when the user quits the // application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down // OpenGL ES frame rates. Games should use this method to pause the game. } - (void)applicationDidEnterBackground:(UIApplication *)application { // Use this method to release shared resources, save user data, invalidate // timers, and store enough application state information to restore your // application to its current state in case it is terminated later. // If your application supports background execution, this method is called // instead of applicationWillTerminate: when the user quits. } - (void)applicationWillEnterForeground:(UIApplication *)application { // Called as part of the transition from the background to the inactive // state; here you can undo many of the changes made on entering the // background. } - (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the // application was inactive. If the application was previously in the // background, optionally refresh the user interface. } - (void)applicationWillTerminate:(UIApplication *)application { // Called when the application is about to terminate. Save data if // appropriate. See also applicationDidEnterBackground:. } @end ================================================ FILE: ZLPeoplePickerViewControllerDemo/ZLPeoplePickerViewControllerDemo/Base.lproj/LaunchScreen.xib ================================================ ================================================ FILE: ZLPeoplePickerViewControllerDemo/ZLPeoplePickerViewControllerDemo/DemoTableViewController.h ================================================ // // HomeTableViewController.h // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/6/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import // UITableView typedef NS_ENUM(NSInteger, DemoTableViewControllerSections) { DemoTableViewControllerSectionPresentationType, DemoTableViewControllerSectionNumSelectionType, DemoTableViewControllerSectionFieldMaskType, DemoTableViewControllerSectionActionType, DemoTableViewControllerSectionShowButton, DemoTableViewControllerSectionCount, }; typedef NS_ENUM(NSInteger, DemoTableViewControllerSectionNumSelectionTypeRows) { DemoTableViewControllerSectionNumSelectionTypeRowSegmentedControl, DemoTableViewControllerSectionNumSelectionTypeRowSlider, DemoTableViewControllerSectionNumSelectionTypeRowCount, }; typedef NS_ENUM(NSInteger, DemoTableViewControllerSectionActionTypeRows) { DemoTableViewControllerSectionActionTypeRowSelection, DemoTableViewControllerSectionActionTypeRowReturn, DemoTableViewControllerSectionActionTypeRowCount, }; // UISegmentedControl typedef NS_ENUM(NSInteger, DemoTableViewControllerSectionPresentationTypes) { DemoTableViewControllerSectionPresentationTypeNormal, DemoTableViewControllerSectionPresentationTypeNav, DemoTableViewControllerSectionPresentationTypeCount, }; typedef NS_ENUM(NSInteger, DemoTableViewControllerSectionNumSelectionTypes) { DemoTableViewControllerSectionNumSelectionTypeNone, DemoTableViewControllerSectionNumSelectionTypeMax, DemoTableViewControllerSectionNumSelectionTypeCustom, DemoTableViewControllerSectionNumSelectionTypeCount }; typedef NS_ENUM(NSInteger, DemoTableViewControllerSectionFieldMaskTypes) { DemoTableViewControllerSectionFieldMaskTypeAll, DemoTableViewControllerSectionFieldMaskTypePhones, DemoTableViewControllerSectionFieldMaskTypeEmails, DemoTableViewControllerSectionFieldMaskTypePhoto, DemoTableViewControllerSectionFieldMaskTypeCount }; typedef NS_ENUM(NSInteger, DemoTableViewControllerSectionFieldMaskRows) { DemoTableViewControllerSectionFieldMaskTypesRow, DemoTableViewControllerSectionFieldMaskFilterRow, DemoTableViewControllerSectionFieldMaskRowCount }; typedef NS_ENUM(NSInteger, DemoTableViewControllerSectionSelectionActionTypes) { DemoTableViewControllerSectionSelectionActionTypePersonViewController, DemoTableViewControllerSectionSelectionActionTypeAlert, DemoTableViewControllerSectionSelectionActionTypeCount, }; typedef NS_ENUM(NSInteger, DemoTableViewControllerSectionReturnActionTypes) { DemoTableViewControllerSectionReturnActionTypeEmail, DemoTableViewControllerSectionReturnActionTypeAlert, DemoTableViewControllerSectionReturnActionTypeCount, }; @interface DemoTableViewController : UITableViewController @end ================================================ FILE: ZLPeoplePickerViewControllerDemo/ZLPeoplePickerViewControllerDemo/DemoTableViewController.m ================================================ // // HomeTableViewController.m // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/6/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import "DemoTableViewController.h" #import "ZLPeoplePickerViewController.h" #import #import #import static int numSelectionSliderMaxValue = 10; @interface DemoTableViewController () < ABPeoplePickerNavigationControllerDelegate, ABPersonViewControllerDelegate, ZLPeoplePickerViewControllerDelegate, MFMailComposeViewControllerDelegate> @property (nonatomic, assign) ABAddressBookRef addressBookRef; @property (nonatomic, strong) ZLPeoplePickerViewController *peoplePicker; @property (strong, nonatomic) UISegmentedControl *presentationSegmentedControl; @property (strong, nonatomic) UISegmentedControl *numSelectionSegmentedControl; @property (strong, nonatomic) UISlider *numSelectionSlider; @property (strong, nonatomic) UILabel *numSelectionLabel; @property (strong, nonatomic) UISegmentedControl *fieldMaskSegmentedControl; @property (strong, nonatomic) UISegmentedControl *selectionActionSegmentedControl; @property (strong, nonatomic) UISegmentedControl *returnActionSegmentedControl; @property (strong, nonatomic) UISwitch *fieldMaskFilterSwitch; @end @implementation DemoTableViewController - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"ZLPeoplePickerViewController"; _addressBookRef = ABAddressBookCreateWithOptions(NULL, NULL); [ZLPeoplePickerViewController initializeAddressBook]; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self numSelectionSegmentedControlAction:self.numSelectionSegmentedControl]; } - (void)numSelectionSegmentedControlAction:(UISegmentedControl *)control { self.selectionActionSegmentedControl.enabled = control.selectedSegmentIndex == DemoTableViewControllerSectionNumSelectionTypeNone; self.returnActionSegmentedControl.enabled = control.selectedSegmentIndex == DemoTableViewControllerSectionNumSelectionTypeMax; self.numSelectionSlider.enabled = control.selectedSegmentIndex == DemoTableViewControllerSectionNumSelectionTypeCustom; if (self.numSelectionSlider.enabled) { [self numSelectionSliderAction:self.numSelectionSlider]; } } - (void)numSelectionSliderAction:(UISlider *)slider { self.numSelectionLabel.text = [self customNumSelectionTypeDescription]; self.selectionActionSegmentedControl.enabled = [self customNumSelectionType] == ZLNumSelectionNone; self.returnActionSegmentedControl.enabled = [self customNumSelectionType] != ZLNumSelectionNone; } #pragma mark - ZLPeoplePickerViewControllerDelegate - (void)peoplePickerViewController:(ZLPeoplePickerViewController *)peoplePicker didSelectPerson:(NSNumber *)recordId { if (peoplePicker.numberOfSelectedPeople == ZLNumSelectionNone) { if (self.selectionActionSegmentedControl.selectedSegmentIndex == DemoTableViewControllerSectionSelectionActionTypePersonViewController) { [self showPersonViewController:[recordId intValue] onNavigationController:peoplePicker.navigationController]; } else { [peoplePicker presentViewController: [self alertControllerWithTitle:@"You have selected:" Message:[self firstNameForPerson: recordId]] animated:YES completion:nil]; } } } - (void)peoplePickerViewController:(ZLPeoplePickerViewController *)peoplePicker didReturnWithSelectedPeople:(NSArray *)people { if (!people || people.count == 0) { return; } if (self.returnActionSegmentedControl.selectedSegmentIndex == DemoTableViewControllerSectionReturnActionTypeEmail) { NSArray *toRecipients = [self emailsForPeople:people]; [self showMailPicker:toRecipients]; } else { [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"); } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return DemoTableViewControllerSectionCount; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section == DemoTableViewControllerSectionNumSelectionType) { return DemoTableViewControllerSectionNumSelectionTypeRowCount; } if (section == DemoTableViewControllerSectionActionType) { return DemoTableViewControllerSectionActionTypeRowCount; } if (section == DemoTableViewControllerSectionFieldMaskType) { return DemoTableViewControllerSectionFieldMaskRowCount; } return 1; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *cellIdentifier = [NSString stringWithFormat:@"s%li-r%li", (long)indexPath.section, (long)indexPath.row]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (!cell) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentifier]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; switch (indexPath.section) { case DemoTableViewControllerSectionPresentationType: { cell.textLabel.text = @"Segue Type"; UISegmentedControl *control = [[UISegmentedControl alloc] initWithItems:@[ @"Push", @"Modal" ]]; control.autoresizingMask = UIViewAutoresizingFlexibleWidth; control.selectedSegmentIndex = 0; cell.accessoryView = control; self.presentationSegmentedControl = control; } break; case DemoTableViewControllerSectionNumSelectionType: { switch (indexPath.row) { case DemoTableViewControllerSectionNumSelectionTypeRowSegmentedControl: { cell.textLabel.text = @"NumSelectedPeople"; UISegmentedControl *control = [[UISegmentedControl alloc] initWithItems:@[ @"None", @"Max", @"Custom" ]]; control.selectedSegmentIndex = 0; cell.accessoryView = control; [control addTarget:self action:@selector(numSelectionSegmentedControlAction:) forControlEvents:UIControlEventValueChanged]; self.numSelectionSegmentedControl = control; } break; case DemoTableViewControllerSectionNumSelectionTypeRowSlider: { cell.textLabel.text = [self customNumSelectionTypeDescription]; self.numSelectionLabel = cell.textLabel; UISlider *control = [[UISlider alloc] init]; control.autoresizingMask = UIViewAutoresizingFlexibleWidth; cell.accessoryView = control; [control addTarget:self action:@selector(numSelectionSliderAction:) forControlEvents:UIControlEventValueChanged]; self.numSelectionSlider = control; } default: break; } } break; case DemoTableViewControllerSectionFieldMaskType: { switch (indexPath.row) { case DemoTableViewControllerSectionFieldMaskTypesRow: { cell.textLabel.text = @"FieldMask"; UISegmentedControl *control = [[UISegmentedControl alloc] initWithItems:@[ @"All", @"Phones", @"Emails", @"Photo" ]]; control.autoresizingMask = UIViewAutoresizingFlexibleWidth; control.selectedSegmentIndex = 0; cell.accessoryView = control; self.fieldMaskSegmentedControl = control; } break; case DemoTableViewControllerSectionFieldMaskFilterRow: { cell.textLabel.text = @"FieldMask Filter"; UISwitch *filterSwitch = [[UISwitch alloc] initWithFrame:CGRectZero]; filterSwitch.autoresizingMask = UIViewAutoresizingFlexibleWidth; filterSwitch.on = NO; cell.accessoryView = filterSwitch; [filterSwitch sizeToFit]; self.fieldMaskFilterSwitch = filterSwitch; } break; default: break; } } break; case DemoTableViewControllerSectionActionType: { switch (indexPath.row) { case DemoTableViewControllerSectionActionTypeRowSelection: { cell.textLabel.text = @"DidSelectAction"; UISegmentedControl *control = [[UISegmentedControl alloc] initWithItems:@[ @"PersonVC", @"Alert" ]]; control.selectedSegmentIndex = 0; control.autoresizingMask = UIViewAutoresizingFlexibleWidth; cell.accessoryView = control; self.selectionActionSegmentedControl = control; } break; case DemoTableViewControllerSectionActionTypeRowReturn: { cell.textLabel.text = @"DidReturnAction"; UISegmentedControl *control = [[UISegmentedControl alloc] initWithItems:@[ @"Send Emails", @"Alert" ]]; control.selectedSegmentIndex = 0; control.autoresizingMask = UIViewAutoresizingFlexibleWidth; cell.accessoryView = control; self.returnActionSegmentedControl = control; } default: break; } } break; case DemoTableViewControllerSectionShowButton: cell.selectionStyle = UITableViewCellSelectionStyleGray; cell.textLabel.text = @"Show People Picker"; cell.textLabel.textColor = self.view.tintColor; break; default: break; } return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; if (indexPath.section != DemoTableViewControllerSectionShowButton) { return; } if (self.presentationSegmentedControl.selectedSegmentIndex == DemoTableViewControllerSectionPresentationTypeNormal) { self.peoplePicker = [[ZLPeoplePickerViewController alloc] init]; self.peoplePicker.delegate = self; [self.navigationController pushViewController:self.peoplePicker animated:YES]; } else { self.peoplePicker = [ZLPeoplePickerViewController presentPeoplePickerViewControllerForParentViewController:self]; } if (self.fieldMaskSegmentedControl.selectedSegmentIndex == DemoTableViewControllerSectionFieldMaskTypeAll) { self.peoplePicker.fieldMask = ZLContactFieldAll; } else if (self.fieldMaskSegmentedControl.selectedSegmentIndex == DemoTableViewControllerSectionFieldMaskTypePhones) { self.peoplePicker.fieldMask = ZLContactFieldPhones; } else if (self.fieldMaskSegmentedControl.selectedSegmentIndex == DemoTableViewControllerSectionFieldMaskTypeEmails) { self.peoplePicker.fieldMask = ZLContactFieldEmails; } else { self.peoplePicker.fieldMask = ZLContactFieldPhoto; } if (self.numSelectionSegmentedControl.selectedSegmentIndex == DemoTableViewControllerSectionNumSelectionTypeNone) { self.peoplePicker.numberOfSelectedPeople = ZLNumSelectionNone; } else if (self.numSelectionSegmentedControl.selectedSegmentIndex == DemoTableViewControllerSectionNumSelectionTypeMax) { self.peoplePicker.numberOfSelectedPeople = ZLNumSelectionMax; } else { self.peoplePicker.numberOfSelectedPeople = [self customNumSelectionType]; } self.peoplePicker.shouldHideUnmaskedContacts = self.fieldMaskFilterSwitch.on; } #pragma mark Display and edit a person - (void)showPersonViewController:(ABRecordID)recordId onNavigationController: (UINavigationController *)navigationController { ABRecordRef person = (ABRecordRef)( ABAddressBookGetPersonWithRecordID(self.addressBookRef, recordId)); if (person != NULL) { ABPersonViewController *picker = [[ABPersonViewController alloc] init]; picker.personViewDelegate = self; picker.displayedPerson = person; // Allow users to edit the person’s information picker.allowsEditing = YES; picker.allowsActions = NO; picker.shouldShowLinkedPeople = YES; [navigationController pushViewController:picker animated:YES]; } else { // Show an alert if "Appleseed" is not in Contacts UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Could not find the person in " @"the Contacts application" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; [alert show]; } } #pragma mark ABPersonViewControllerDelegate methods // Does not allow users to perform default actions such as dialing a phone // number, when they select a contact property. - (BOOL)personViewController:(ABPersonViewController *)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)person property:(ABPropertyID)property identifier: (ABMultiValueIdentifier)identifierForValue { return NO; } #pragma mark - Compose Mail/SMS - (void)displayMailComposerSheet:(NSArray *)recipients { MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; [picker setToRecipients:recipients]; [picker setSubject:@"Check Out ZLPeoplePickerViewController!"]; NSString *emailBody = @"Check Out ZLPeoplePickerViewController at " @"https://github.com/zhxnlai/" @"ZLPeoplePickerViewController"; [picker setMessageBody:emailBody isHTML:NO]; [self presentViewController:picker animated:YES completion:NULL]; } - (void)showMailPicker:(NSArray *)recipients { // You must check that the current device can send email messages before you // attempt to create an instance of MFMailComposeViewController. If the // device can not send email messages, // [[MFMailComposeViewController alloc] init] will return nil. Your app // will crash when it calls -presentViewController:animated:completion: with // a nil view controller. if ([MFMailComposeViewController canSendMail]) // The device can send email. { [self displayMailComposerSheet:recipients]; } else // The device can not send email. { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Cannot send text" message:@"Device not configured to send email." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; } } - (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error { // Notifies users about errors associated with the interface switch (result) { case MFMailComposeResultCancelled: break; case MFMailComposeResultSaved: break; case MFMailComposeResultSent: break; case MFMailComposeResultFailed: break; default: // self.feedbackMsg.text = @"Result: Mail not sent"; break; } [self dismissViewControllerAnimated:YES completion:NULL]; } #pragma mark - () - (NSString *)customNumSelectionTypeDescription { return [NSString stringWithFormat:@"Custom: %lu Selected People", [self customNumSelectionType]]; } - (ZLNumSelection)customNumSelectionType { return self.numSelectionSlider.value * numSelectionSliderMaxValue; } - (UIAlertController *)alertControllerWithTitle:(NSString *)title Message:(NSString *)message { UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { [alert dismissViewControllerAnimated:YES completion:nil]; }]; [alert addAction:ok]; return alert; } - (NSArray *)emailsForPeople:(NSArray *)recordIds { NSMutableArray *emails = [NSMutableArray array]; for (NSNumber *recordId in recordIds) { [emails addObjectsFromArray:[self emailsForPerson:recordId]]; } return emails; } - (NSArray *)emailsForPerson:(NSNumber *)recordId { return [self arrayProperty:kABPersonEmailProperty fromRecord:[self recordRefFromRecordId:recordId]]; } - (NSArray *)firstNameForPeople:(NSArray *)recordIds { NSMutableArray *firstNames = [NSMutableArray array]; for (NSNumber *recordId in recordIds) { NSString *firstName = [self firstNameForPerson:recordId]; if (firstName) { [firstNames addObject:firstName]; } } return firstNames; } - (NSString *)firstNameForPerson:(NSNumber *)recordId { NSString *firstName = (__bridge_transfer NSString *)ABRecordCopyValue( [self recordRefFromRecordId:recordId], kABPersonFirstNameProperty); return firstName; } - (ABRecordRef)recordRefFromRecordId:(NSNumber *)recordId { return ABAddressBookGetPersonWithRecordID(self.addressBookRef, [recordId intValue]); } - (NSArray *)arrayProperty:(ABPropertyID)property fromRecord:(ABRecordRef)recordRef { NSMutableArray *array = [[NSMutableArray alloc] init]; [self enumerateMultiValueOfProperty:property fromRecord:recordRef withBlock:^(ABMultiValueRef multiValue, NSUInteger index) { CFTypeRef value = ABMultiValueCopyValueAtIndex( multiValue, index); NSString *string = (__bridge_transfer NSString *)value; if (string) { [array addObject:string]; } }]; return array.copy; } - (void)enumerateMultiValueOfProperty:(ABPropertyID)property fromRecord:(ABRecordRef)recordRef withBlock:(void (^)(ABMultiValueRef multiValue, NSUInteger index))block { ABMultiValueRef multiValue = ABRecordCopyValue(recordRef, property); NSUInteger count = (NSUInteger)ABMultiValueGetCount(multiValue); for (NSUInteger i = 0; i < count; i++) { block(multiValue, i); } CFRelease(multiValue); } @end ================================================ FILE: ZLPeoplePickerViewControllerDemo/ZLPeoplePickerViewControllerDemo/Images.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "3x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "3x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: ZLPeoplePickerViewControllerDemo/ZLPeoplePickerViewControllerDemo/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier com.axcel.$(PRODUCT_NAME:rfc1034identifier) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 LSRequiresIPhoneOS UILaunchStoryboardName LaunchScreen UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: ZLPeoplePickerViewControllerDemo/ZLPeoplePickerViewControllerDemo/main.m ================================================ // // main.m // ZLPeoplePickerViewControllerDemo // // Created by Zhixuan Lai on 11/4/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import #import "AppDelegate.h" int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } ================================================ FILE: ZLPeoplePickerViewControllerDemo/ZLPeoplePickerViewControllerDemo.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 094FA06B1A0C39A700A19F44 /* DemoTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 094FA06A1A0C39A700A19F44 /* DemoTableViewController.m */; }; 0971D4A61A09B01600325B8D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0971D4A51A09B01600325B8D /* main.m */; }; 0971D4A91A09B01600325B8D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0971D4A81A09B01600325B8D /* AppDelegate.m */; }; 0971D4B11A09B01600325B8D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0971D4B01A09B01600325B8D /* Images.xcassets */; }; 0971D4B41A09B01600325B8D /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0971D4B21A09B01600325B8D /* LaunchScreen.xib */; }; 0971D4C01A09B01600325B8D /* ZLPeoplePickerViewControllerDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0971D4BF1A09B01600325B8D /* ZLPeoplePickerViewControllerDemoTests.m */; }; 09AF0ADB1A1180EA007805AE /* APContact+Sorting.m in Sources */ = {isa = PBXBuildFile; fileRef = 09AF0AD01A1180EA007805AE /* APContact+Sorting.m */; }; 09AF0ADC1A1180EA007805AE /* LRIndexedCollationWithSearch.m in Sources */ = {isa = PBXBuildFile; fileRef = 09AF0AD21A1180EA007805AE /* LRIndexedCollationWithSearch.m */; }; 09AF0ADD1A1180EA007805AE /* ZLBaseTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 09AF0AD41A1180EA007805AE /* ZLBaseTableViewController.m */; }; 09AF0ADE1A1180EA007805AE /* ZLResultsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 09AF0AD61A1180EA007805AE /* ZLResultsTableViewController.m */; }; 09AF0AE01A1180EA007805AE /* ZLPeoplePickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 09AF0ADA1A1180EA007805AE /* ZLPeoplePickerViewController.m */; }; 09AF0AE71A12C1ED007805AE /* ZLAddressBook.m in Sources */ = {isa = PBXBuildFile; fileRef = 09AF0AE61A12C1ED007805AE /* ZLAddressBook.m */; }; 9368C6EAA371E3ACDA194FB1 /* libPods-ZLPeoplePickerViewControllerDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A4FCD87F625E561E254D054 /* libPods-ZLPeoplePickerViewControllerDemo.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 0971D4BA1A09B01600325B8D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0971D4981A09B01600325B8D /* Project object */; proxyType = 1; remoteGlobalIDString = 0971D49F1A09B01600325B8D; remoteInfo = ZLPeoplePickerViewControllerDemo; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 094FA0691A0C39A700A19F44 /* DemoTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoTableViewController.h; sourceTree = ""; }; 094FA06A1A0C39A700A19F44 /* DemoTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoTableViewController.m; sourceTree = ""; }; 0971D4A01A09B01600325B8D /* ZLPeoplePickerViewControllerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ZLPeoplePickerViewControllerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 0971D4A41A09B01600325B8D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 0971D4A51A09B01600325B8D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 0971D4A71A09B01600325B8D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 0971D4A81A09B01600325B8D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 0971D4B01A09B01600325B8D /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 0971D4B31A09B01600325B8D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 0971D4B91A09B01600325B8D /* ZLPeoplePickerViewControllerDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ZLPeoplePickerViewControllerDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 0971D4BE1A09B01600325B8D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 0971D4BF1A09B01600325B8D /* ZLPeoplePickerViewControllerDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZLPeoplePickerViewControllerDemoTests.m; sourceTree = ""; }; 09AF0ACF1A1180EA007805AE /* APContact+Sorting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "APContact+Sorting.h"; sourceTree = ""; }; 09AF0AD01A1180EA007805AE /* APContact+Sorting.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "APContact+Sorting.m"; sourceTree = ""; }; 09AF0AD11A1180EA007805AE /* LRIndexedCollationWithSearch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LRIndexedCollationWithSearch.h; sourceTree = ""; }; 09AF0AD21A1180EA007805AE /* LRIndexedCollationWithSearch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LRIndexedCollationWithSearch.m; sourceTree = ""; }; 09AF0AD31A1180EA007805AE /* ZLBaseTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZLBaseTableViewController.h; sourceTree = ""; }; 09AF0AD41A1180EA007805AE /* ZLBaseTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZLBaseTableViewController.m; sourceTree = ""; }; 09AF0AD51A1180EA007805AE /* ZLResultsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZLResultsTableViewController.h; sourceTree = ""; }; 09AF0AD61A1180EA007805AE /* ZLResultsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZLResultsTableViewController.m; sourceTree = ""; }; 09AF0AD91A1180EA007805AE /* ZLPeoplePickerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZLPeoplePickerViewController.h; sourceTree = ""; }; 09AF0ADA1A1180EA007805AE /* ZLPeoplePickerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZLPeoplePickerViewController.m; sourceTree = ""; }; 09AF0AE41A12909C007805AE /* ZLTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZLTypes.h; sourceTree = ""; }; 09AF0AE51A12C1ED007805AE /* ZLAddressBook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZLAddressBook.h; sourceTree = ""; }; 09AF0AE61A12C1ED007805AE /* ZLAddressBook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZLAddressBook.m; sourceTree = ""; }; 16F05380A033F1C8963BECC2 /* Pods-ZLPeoplePickerViewControllerDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ZLPeoplePickerViewControllerDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-ZLPeoplePickerViewControllerDemo/Pods-ZLPeoplePickerViewControllerDemo.release.xcconfig"; sourceTree = ""; }; 7A4FCD87F625E561E254D054 /* libPods-ZLPeoplePickerViewControllerDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ZLPeoplePickerViewControllerDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 7E9F2DD6A233D1682F81CCD3 /* Pods-ZLPeoplePickerViewControllerDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ZLPeoplePickerViewControllerDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ZLPeoplePickerViewControllerDemo/Pods-ZLPeoplePickerViewControllerDemo.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 0971D49D1A09B01600325B8D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 9368C6EAA371E3ACDA194FB1 /* libPods-ZLPeoplePickerViewControllerDemo.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; 0971D4B61A09B01600325B8D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 0971D4971A09B01600325B8D = { isa = PBXGroup; children = ( 0971D4A21A09B01600325B8D /* ZLPeoplePickerViewControllerDemo */, 0971D4BC1A09B01600325B8D /* ZLPeoplePickerViewControllerDemoTests */, 0971D4A11A09B01600325B8D /* Products */, 0D4B11041DA95E11C15BBB66 /* Pods */, 57998266035A2B62A632C1FA /* Frameworks */, ); sourceTree = ""; }; 0971D4A11A09B01600325B8D /* Products */ = { isa = PBXGroup; children = ( 0971D4A01A09B01600325B8D /* ZLPeoplePickerViewControllerDemo.app */, 0971D4B91A09B01600325B8D /* ZLPeoplePickerViewControllerDemoTests.xctest */, ); name = Products; sourceTree = ""; }; 0971D4A21A09B01600325B8D /* ZLPeoplePickerViewControllerDemo */ = { isa = PBXGroup; children = ( 09AF0ACD1A1180EA007805AE /* ZLPeoplePickerViewController */, 0971D4A71A09B01600325B8D /* AppDelegate.h */, 0971D4A81A09B01600325B8D /* AppDelegate.m */, 094FA0691A0C39A700A19F44 /* DemoTableViewController.h */, 094FA06A1A0C39A700A19F44 /* DemoTableViewController.m */, 0971D4B01A09B01600325B8D /* Images.xcassets */, 0971D4B21A09B01600325B8D /* LaunchScreen.xib */, 0971D4A31A09B01600325B8D /* Supporting Files */, ); path = ZLPeoplePickerViewControllerDemo; sourceTree = ""; }; 0971D4A31A09B01600325B8D /* Supporting Files */ = { isa = PBXGroup; children = ( 0971D4A41A09B01600325B8D /* Info.plist */, 0971D4A51A09B01600325B8D /* main.m */, ); name = "Supporting Files"; sourceTree = ""; }; 0971D4BC1A09B01600325B8D /* ZLPeoplePickerViewControllerDemoTests */ = { isa = PBXGroup; children = ( 0971D4BF1A09B01600325B8D /* ZLPeoplePickerViewControllerDemoTests.m */, 0971D4BD1A09B01600325B8D /* Supporting Files */, ); path = ZLPeoplePickerViewControllerDemoTests; sourceTree = ""; }; 0971D4BD1A09B01600325B8D /* Supporting Files */ = { isa = PBXGroup; children = ( 0971D4BE1A09B01600325B8D /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; 09AF0ACD1A1180EA007805AE /* ZLPeoplePickerViewController */ = { isa = PBXGroup; children = ( 09AF0ACE1A1180EA007805AE /* Internal */, 09AF0AD91A1180EA007805AE /* ZLPeoplePickerViewController.h */, 09AF0ADA1A1180EA007805AE /* ZLPeoplePickerViewController.m */, ); name = ZLPeoplePickerViewController; path = ../../ZLPeoplePickerViewController; sourceTree = ""; }; 09AF0ACE1A1180EA007805AE /* Internal */ = { isa = PBXGroup; children = ( 09AF0ACF1A1180EA007805AE /* APContact+Sorting.h */, 09AF0AD01A1180EA007805AE /* APContact+Sorting.m */, 09AF0AD11A1180EA007805AE /* LRIndexedCollationWithSearch.h */, 09AF0AD21A1180EA007805AE /* LRIndexedCollationWithSearch.m */, 09AF0AD31A1180EA007805AE /* ZLBaseTableViewController.h */, 09AF0AD41A1180EA007805AE /* ZLBaseTableViewController.m */, 09AF0AD51A1180EA007805AE /* ZLResultsTableViewController.h */, 09AF0AD61A1180EA007805AE /* ZLResultsTableViewController.m */, 09AF0AE51A12C1ED007805AE /* ZLAddressBook.h */, 09AF0AE61A12C1ED007805AE /* ZLAddressBook.m */, 09AF0AE41A12909C007805AE /* ZLTypes.h */, ); path = Internal; sourceTree = ""; }; 0D4B11041DA95E11C15BBB66 /* Pods */ = { isa = PBXGroup; children = ( 7E9F2DD6A233D1682F81CCD3 /* Pods-ZLPeoplePickerViewControllerDemo.debug.xcconfig */, 16F05380A033F1C8963BECC2 /* Pods-ZLPeoplePickerViewControllerDemo.release.xcconfig */, ); name = Pods; sourceTree = ""; }; 57998266035A2B62A632C1FA /* Frameworks */ = { isa = PBXGroup; children = ( 7A4FCD87F625E561E254D054 /* libPods-ZLPeoplePickerViewControllerDemo.a */, ); name = Frameworks; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 0971D49F1A09B01600325B8D /* ZLPeoplePickerViewControllerDemo */ = { isa = PBXNativeTarget; buildConfigurationList = 0971D4C31A09B01600325B8D /* Build configuration list for PBXNativeTarget "ZLPeoplePickerViewControllerDemo" */; buildPhases = ( 2257FE0DB79C9D49CB87EA04 /* Check Pods Manifest.lock */, 0971D49C1A09B01600325B8D /* Sources */, 0971D49D1A09B01600325B8D /* Frameworks */, 0971D49E1A09B01600325B8D /* Resources */, 84C8CBA57F703DD894BE91D4 /* Copy Pods Resources */, 974FE72DFFC308BD5D190419 /* Embed Pods Frameworks */, ); buildRules = ( ); dependencies = ( ); name = ZLPeoplePickerViewControllerDemo; productName = ZLPeoplePickerViewControllerDemo; productReference = 0971D4A01A09B01600325B8D /* ZLPeoplePickerViewControllerDemo.app */; productType = "com.apple.product-type.application"; }; 0971D4B81A09B01600325B8D /* ZLPeoplePickerViewControllerDemoTests */ = { isa = PBXNativeTarget; buildConfigurationList = 0971D4C61A09B01600325B8D /* Build configuration list for PBXNativeTarget "ZLPeoplePickerViewControllerDemoTests" */; buildPhases = ( 0971D4B51A09B01600325B8D /* Sources */, 0971D4B61A09B01600325B8D /* Frameworks */, 0971D4B71A09B01600325B8D /* Resources */, ); buildRules = ( ); dependencies = ( 0971D4BB1A09B01600325B8D /* PBXTargetDependency */, ); name = ZLPeoplePickerViewControllerDemoTests; productName = ZLPeoplePickerViewControllerDemoTests; productReference = 0971D4B91A09B01600325B8D /* ZLPeoplePickerViewControllerDemoTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 0971D4981A09B01600325B8D /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0610; ORGANIZATIONNAME = "Zhixuan Lai"; TargetAttributes = { 0971D49F1A09B01600325B8D = { CreatedOnToolsVersion = 6.1; }; 0971D4B81A09B01600325B8D = { CreatedOnToolsVersion = 6.1; TestTargetID = 0971D49F1A09B01600325B8D; }; }; }; buildConfigurationList = 0971D49B1A09B01600325B8D /* Build configuration list for PBXProject "ZLPeoplePickerViewControllerDemo" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 0971D4971A09B01600325B8D; productRefGroup = 0971D4A11A09B01600325B8D /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 0971D49F1A09B01600325B8D /* ZLPeoplePickerViewControllerDemo */, 0971D4B81A09B01600325B8D /* ZLPeoplePickerViewControllerDemoTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 0971D49E1A09B01600325B8D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 0971D4B41A09B01600325B8D /* LaunchScreen.xib in Resources */, 0971D4B11A09B01600325B8D /* Images.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; 0971D4B71A09B01600325B8D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ 2257FE0DB79C9D49CB87EA04 /* Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; 84C8CBA57F703DD894BE91D4 /* Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ZLPeoplePickerViewControllerDemo/Pods-ZLPeoplePickerViewControllerDemo-resources.sh\"\n"; showEnvVarsInLog = 0; }; 974FE72DFFC308BD5D190419 /* Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ZLPeoplePickerViewControllerDemo/Pods-ZLPeoplePickerViewControllerDemo-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 0971D49C1A09B01600325B8D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 09AF0ADD1A1180EA007805AE /* ZLBaseTableViewController.m in Sources */, 09AF0ADE1A1180EA007805AE /* ZLResultsTableViewController.m in Sources */, 09AF0ADB1A1180EA007805AE /* APContact+Sorting.m in Sources */, 09AF0AE01A1180EA007805AE /* ZLPeoplePickerViewController.m in Sources */, 0971D4A91A09B01600325B8D /* AppDelegate.m in Sources */, 0971D4A61A09B01600325B8D /* main.m in Sources */, 094FA06B1A0C39A700A19F44 /* DemoTableViewController.m in Sources */, 09AF0ADC1A1180EA007805AE /* LRIndexedCollationWithSearch.m in Sources */, 09AF0AE71A12C1ED007805AE /* ZLAddressBook.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 0971D4B51A09B01600325B8D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 0971D4C01A09B01600325B8D /* ZLPeoplePickerViewControllerDemoTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 0971D4BB1A09B01600325B8D /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 0971D49F1A09B01600325B8D /* ZLPeoplePickerViewControllerDemo */; targetProxy = 0971D4BA1A09B01600325B8D /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ 0971D4B21A09B01600325B8D /* LaunchScreen.xib */ = { isa = PBXVariantGroup; children = ( 0971D4B31A09B01600325B8D /* Base */, ); name = LaunchScreen.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 0971D4C11A09B01600325B8D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.1; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 0971D4C21A09B01600325B8D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.1; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; name = Release; }; 0971D4C41A09B01600325B8D /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7E9F2DD6A233D1682F81CCD3 /* Pods-ZLPeoplePickerViewControllerDemo.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = ZLPeoplePickerViewControllerDemo/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 0971D4C51A09B01600325B8D /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 16F05380A033F1C8963BECC2 /* Pods-ZLPeoplePickerViewControllerDemo.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = ZLPeoplePickerViewControllerDemo/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; 0971D4C71A09B01600325B8D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = ZLPeoplePickerViewControllerDemoTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZLPeoplePickerViewControllerDemo.app/ZLPeoplePickerViewControllerDemo"; }; name = Debug; }; 0971D4C81A09B01600325B8D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", ); INFOPLIST_FILE = ZLPeoplePickerViewControllerDemoTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZLPeoplePickerViewControllerDemo.app/ZLPeoplePickerViewControllerDemo"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 0971D49B1A09B01600325B8D /* Build configuration list for PBXProject "ZLPeoplePickerViewControllerDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 0971D4C11A09B01600325B8D /* Debug */, 0971D4C21A09B01600325B8D /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 0971D4C31A09B01600325B8D /* Build configuration list for PBXNativeTarget "ZLPeoplePickerViewControllerDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 0971D4C41A09B01600325B8D /* Debug */, 0971D4C51A09B01600325B8D /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 0971D4C61A09B01600325B8D /* Build configuration list for PBXNativeTarget "ZLPeoplePickerViewControllerDemoTests" */ = { isa = XCConfigurationList; buildConfigurations = ( 0971D4C71A09B01600325B8D /* Debug */, 0971D4C81A09B01600325B8D /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 0971D4981A09B01600325B8D /* Project object */; } ================================================ FILE: ZLPeoplePickerViewControllerDemo/ZLPeoplePickerViewControllerDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: ZLPeoplePickerViewControllerDemo/ZLPeoplePickerViewControllerDemo.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: ZLPeoplePickerViewControllerDemo/ZLPeoplePickerViewControllerDemoTests/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier com.axcel.$(PRODUCT_NAME:rfc1034identifier) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 ================================================ FILE: ZLPeoplePickerViewControllerDemo/ZLPeoplePickerViewControllerDemoTests/ZLPeoplePickerViewControllerDemoTests.m ================================================ // // ZLPeoplePickerViewControllerDemoTests.m // ZLPeoplePickerViewControllerDemoTests // // Created by Zhixuan Lai on 11/4/14. // Copyright (c) 2014 Zhixuan Lai. All rights reserved. // #import #import @interface ZLPeoplePickerViewControllerDemoTests : XCTestCase @end @implementation ZLPeoplePickerViewControllerDemoTests - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; } - (void)testExample { // This is an example of a functional test case. XCTAssert(YES, @"Pass"); } - (void)testPerformanceExample { // This is an example of a performance test case. [self measureBlock:^{ // Put the code you want to measure the time of here. }]; } @end