Code Monkey home page Code Monkey logo

addressbookpeoplepicker's Introduction

Demonstration of using the Address Book People Picker as well as using a callback for Address Book.

I show how to implement the People Picker with the ability to edit existing contacts or create new contacts. Two methods are shown.

Method 1

The first method (must uncomment the define for PERSON_VIEW_CONTROLLER_METHOD1 in AddressBookPeoplePickerViewController.m) is based on the nice blog article by Scott Sherwood at:

http://www.scott-sherwood.com/ios5-removing-the-cancel-button-on-abpeoplepickernavigationcontroller/

I've corrected the example to fix an issue with hitting the Cancel button while editing.

Clicking Cancel in the corrected example will dismiss the entire People Picker. There was no way to simply stop editing mode without also committing any changes that may have been made.

Method 2

The second method (comment out the define for PERSON_VIEW_CONTROLLER_METHOD1 in AddressBookPeoplePickerViewController.m) is a modification to Scott Sherwood's approach. Here we manually put up the ABPersonViewController in the protocol method peoplePickerNavigationController:shouldContinueAfterSelectingPerson:

This allows me to simplify the code and not worry about modifying the navigation item buttons for the ABPersonViewController view.

The issue I noted with this method is that the information in the ABPeoplePickerNavigationController view (names) is not automatically updated when a name is edited (and user clicks Done). There is no public API exposed for performing a refresh. What I do here is to perform a dummy save when I detect a change in the Address Book. This dummy Address Book save will force a refresh of the People Picker table view.

addressbookpeoplepicker's People

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.