IOS and AddressBook CS4521. Address Book UI Framework Exploring Contacts.

Slides:



Advertisements
Similar presentations
View-Based Application Development Lecture 1 1. Flows of Lecture 1 Before Lab Introduction to the Game to be developed in this workshop Comparison between.
Advertisements

Detecting Collisions CSE 391 Fall 2012 Tony Scarlatos.
Create a calculator– 2nd iPhone programming exercise CSE 391 Fall 2012.
© 2010 Delmar, Cengage Learning Chapter 1 Getting Started with Dreamweaver.
View Controllers (second part) Content taken from book: “iPhone SDK Development” by Bill Dudney and Chris Adamson.
Explore the Dreamweaver Workspace View a Web page and use Help Plan and Define a Web site Add a Folder and Pages, and set the Home page Create and View.
1 of 6 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Creating a Blank Database 1. Open up Microsoft Access 2. Click on Blank document button 3. On the right panel, Specify the location for saving your database.
Storyboards Managing multiple views. Overview Create a single view application Give the project a name and click “Use Storyboards” and “Use Automatic.
BoardMaker Ver 6 Creating Interactive Activities for the Classroom.
Working with SharePoint Document Libraries. What are document libraries? Document libraries are collections of files that you can share with team members.
Tutorial 8 Managing and Securing a Database. Objectives Filter data in a table and a form Save a filter as a query and apply the saved query as a filter.
The basics of the Online Portal
Sprite Animation CSE 391 Fall 2012 Tony Scarlatos.
1 Outlook Lesson 1 Outlook Basics and Microsoft Office 2010 Introductory Pasewark & Pasewark.
Adobe Dreamweaver CS3 Revealed CHAPTER ONE: GETTING STARTED WITH DREAMWEAVER.
Creating a Website. Unit Objectives Plan a website Create a folder for website management Set up a website Add a folder to a website Save a web page Copy.
Xcode Presentation Tom Pletzke. Creating App from template Launch Xcode Select Tabbed Application.
Uploading, Creating and Modifying Forms in simplifyMD.
Tutorial 1: Getting Started with Adobe Dreamweaver CS4.
With Windows XP, you can share files and documents with other users on your computer and with other users on a network. There is a new user interface.
Mail merge I: Use mail merge for mass mailings Perform a complete mail merge Now you’ll walk through the process of performing a mail merge by using the.
PHP meets MySQL.
Domain 3 Understanding the Adobe Dreamweaver CS5 Interface.
Macromedia Dreamweaver 8 Revealed DREAMWEAVER GETTING STARTED WITH.
Objective C Basics. It’s C with Some Extras!  Cross Platform language  Mac  Linux/UNIX  Windows  Layer above C (Superset)  Adds Object-Oriented.
© 2010 Delmar, Cengage Learning Chapter 3: Working with Symbols and Interactivity.
Key Applications Module Lesson 21 — Access Essentials
Adobe Flash CS3 Revealed Chapter 3 - WORKING WITH SYMBOLS AND INTERACTIVITY.
Access Manual 2 By Dhawala Kovuri Elham S.Khorasani Ismail Guneydas.
Forms Training. Tested Formatted The Template Library.
Tabbed Views UITabBarController. Controller Architecture UITabBarController Controls the first view that the user sees The view controller class (and.
CSC 240 (Blum)1 Forms and Importing Data in Access.
Using Xcode A Beginner’s Tutorial Erin Green. This tutorial will walk you through Xcode, a software development tool for Apple’s iOS applications – We.
Macromedia Dreamweaver 8-- Illustrated Introductory 1 Macromedia Dreamweaver 8 Unit B Creating a Web Site.
Microsoft Outlook 2010 Chapter 3 Managing Contacts and Personal Contact Information with Outlook.
View Controllers Content taken from book: “iPhone SDK Development” by Bill Dudney and Chris Adamson.
Adobe Dreamweaver CS3 Revealed CHAPTER SIX: MANAGING A WEB SERVER AND FILES.
Roles 1. Your Role: End User End Users use Inside NCDOT and Connect NCDOT for basic browsing and reading Typical tasks can include: Open or download files.
COMPREHENSIVE Access Tutorial 12 Managing and Securing a Database.
® Microsoft Access 2010 Tutorial 12 Managing and Securing a Database.
Chapter 1 Getting Started With Dreamweaver. Exploring the Dreamweaver Workspace The Dreamweaver workspace is where you can find all the tools to create.
Macromedia Flash 8 Revealed WORKING WITH SYMBOLS AND INTERACTIVITY.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
IMovie 10 Overview. Importing Files from a Video Camera into iMovie 1.Plug the camera into a wall outlet using the power supply. (Some cameras will not.
MS-Access XP Lesson 4. Modifying Queries 1.Select query in queries 2.Click design button or Right click on query and click design view 3.Change query.
The iOS Platform and SDK. iOS iPhoneiPad Mini iPad.
1 Reverse a String iPhone/iPad, iOS Development Tutorial.
Using Middle Search® Plus For Junior Academic Bowl Competitions.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 8 1 Microsoft Office Access 2003 Tutorial 8 – Integrating Access with the.
Folio3 IPhone Training Session 2 Testing App on device Presenter: Imam Raza.
VB.NET and Databases. ADO.NET VB.Net allows you many ways to connect to a database. The technology used to interact with a database or data source is.
® Microsoft Access 2010 Tutorial 8 Managing and Securing a Database.
NIMAC for Accessible Media Producers: February 2013 NIMAC 2.0 for AMPs.
WebViews UIWebView. Controller Architecture UITabBarController Controls the first view that the user sees The view controller class (and xib) that manages.
1 디바이스 정보  UIDevice 클래스가 제공하고 static 메서드인 currentDevice 가 객체를 생성합 니다.  제공하는 정보 uniqueIdentifier: 장치 고유 ID / 회원가입을 하지 않고 어플을 운영 가능 model: 모델명 systemVersion:
Perform a complete mail merge Lesson 14 By the end of this lesson you will be able to complete the following: Use the Mail Merge Wizard to perform a basic.
Iphone Online Training AcuteSoft: India: , Land Line: +91 (0) USA: , UK : +44.
Recruiter 2.0 Overview May 1, 2012.
About SharePoint Server 2007 My Sites
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
EEC-492/693/793 iPhone Application Development
MODULE 7 Microsoft Access 2010
Using Templates and Library Items
Guidelines for Microsoft® Office 2013
EEC-492/693/793 iPhone Application Development
Tutorial 8 Sharing, Integrating, and Analyzing Data
Tutorial 12 Managing and Securing a Database
Presentation transcript:

iOS and AddressBook CS4521

Address Book UI Framework Exploring Contacts

Address Book UI The Address Book UI framework provides controllers that facilitate displaying, editing, selecting, and creating records in the Address Book database. On the iPhone, contact data resides in the home Library folder. On the Macintosh simulator, you can freely access these files in ~/Library/Application Support/iPhone Simulator/User/Library.

Address Book UI The two files, AddressBook/AddressBook.sqlitedb and AddressBook/AddressBookImages.sqlitedb use standard SQLite3 to store contact information and optional contact images. On the iPhone, you cannot access these directly. The files live in /var/mobile/Library/AddressBook The Address Book UI framework provides two key user interfaces: a people "picker" navigation controller to choose contacts, and a view controller to display a single contact.

Working with Address Book Objects There are four basic objects that you need to understand in order to interact fully with the Address Book database: address books, records, single-value properties, and multivalue properties

Address Book Address books let you interact with the Address Book database and save changes to it. To use an address book, declare an instance of ABAddressBookRef and set it to the value returned from the function ABAddressBookCreate. ABAddressBookCreate After you have created an address book reference, your application can read data from it and save changes to it. To save the changes, use the function ABAddressBookSave; to abandon them, use the function ABAddressBookRevert. To check whether there are unsaved changes, use the function ABAddressBookHasUnsavedChanges. ABAddressBookSaveABAddressBookRevert ABAddressBookHasUnsavedChanges

Person Records Person records are made up of both single-value and multi-value properties. Properties that a person can have only one of, such as first name and last name, are stored as single-value properties. Other properties that a person can have more that one of, such as street address and phone number, are multi-value properties.

Group Records Users may organize their contacts into groups for a variety of reasons. For example, a user may create a group containing coworkers involved in a project, or members of a sports team they play on. Your application can use groups to allow the user to perform an action for several contacts in their address book at the same time. Group records have only one property, kABGroupNameProperty, which is the name of the group. To get all the people in a group, use the function ABGroupCopyArrayOfAllMembersWithSortOrdering or ABGroupCopyArrayOfAllMembers, which return a CFArray of ABRecordRef objects with and without sorting. ABGroupCopyArrayOfAllMembersWithSortOrdering ABGroupCopyArrayOfAllMembers

Interacting Using UI Controllers The Address Book UI framework provides one view controller and three navigation controllers for common tasks related to working with the Address Book database and contact information. o ABPeoplePickerNavigationController prompts the user to select a person record from their address book. ABPeoplePickerNavigationController o ABPersonViewController displays a person record to the user and optionally allows editing. ABPersonViewController

o ABNewPersonViewController prompts the user create a new person record. ABNewPersonViewController o ABUnknownPersonViewController prompts the user to complete a partial person record, optionally allows them to add it to the address book. ABUnknownPersonViewController To use these controllers, you must set a delegate for them which implements the appropriate delegate protocol.

ABPeoplePickerNavigationControlle r Allows users to browse their list of contacts and select a person and, at your option, one of that person’s properties.

ABPersonViewController ABPersonViewController Displays a record to the user. Person view controller—displaying with editing allowed

ABNewPersonViewController Allows users to create a new person

ABUnknownPersonViewController Allows the user to add data to an existing person record or to create a new person record for the data.

Create the Project In Xcode, create a new project from the View Based Application template. Save the project as QuickStart. The next step is to add the frameworks you will need. First, go to your project window and find the target named QuickStart in the Targets group. Open its info panel (File > Get Info) and, in the General tab, you see a list of linked libraries. Add the Address Book and Address Book UI frameworks by clicking the plus button and selecting them from the list.

QuickStartViewController.xib.

QuickStartViewController : UIViewController { IBOutlet UILabel *firstName; IBOutlet UILabel *lastName; (nonatomic, retain) UILabel (nonatomic, retain) UILabel *lastName; -

QuickStartViewController.m #import lastName; -(IBAction)showPicker:(id)sender { ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init]; picker.peoplePickerDelegate = self; [self presentModalViewController:picker animated:YES]; [picker release]; }

you will now begin implementing the delegate protocol, by adding two more methods. If the user cancels, the first method is called to dismiss the people picker. If the user selects a person, the second method is called to copy the first and last name of the person into the labels and dismiss the people picker.

(void)peoplePickerNavigationControllerDidCancel: (ABPeoplePickerNavigationController*) peoplePicker { [self dismissModalViewControllerAnimated:YES]; }

- (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person { NSString* name = (NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty); self.firstName.text = name; [name release]; name = (NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty); self.lastName.text = name; [name release]; [self dismissModalViewControllerAnimated:YES]; return NO; }

To fully implement the delegate protocol, you must also add one more following function. The people picker calls this third function when the user taps on a property of the selected person in the picker. In this application, the people picker is dismissed when the user selects a person, so there is no way for the user to select a property of that person. This means that the third method can never be called. However if it were left out, the implementation of the protocol would be incomplete.

(BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson: (ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier { return NO; } (void)dealloc { [firstName release]; [lastName release]; [super dealloc];

Make Connections In the Identity inspector (Tools > Identity Inspector), verify that the class identity of File’s Owner is QuickStartViewController—it should already be set correctly for you by the template. Connect the outlets for firstName and lastName from File’s Owner to the first name and last name labels. Finally, connect the Touch Up Inside outlet from the button to File’s Owner and select the showPicker method.