vb.net print barcode labels People-picker: a simple, graphical way to select contacts in Objective-C

Printing QR Code in Objective-C People-picker: a simple, graphical way to select contacts

Listing 9.6 People-picker: a simple, graphical way to select contacts
Make Quick Response Code In Objective-C
Using Barcode drawer for iPhone Control to generate, create QR Code 2d barcode image in iPhone applications.
www.OnBarcode.com
Code 39 Full ASCII Generation In Objective-C
Using Barcode printer for iPhone Control to generate, create ANSI/AIM Code 39 image in iPhone applications.
www.OnBarcode.com
-(IBAction)selectContact:(id)sender { ABPeoplePickerNavigationController *myPicker = Creates [[ABPeoplePickerNavigationController alloc] people picker init]; myPicker.peoplePickerDelegate = self; Sets delegate [self presentModalViewController:myPicker Displays animated:YES]; people picker [myPicker release]; } - (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson: (ABRecordRef)thisPerson { CFIndex abPCount = Gets ABAddressBookGetPersonCount overall (peoplePicker.addressBook); counts CFIndex abGCount = ABAddressBookGetGroupCount (peoplePicker.addressBook); myText.text = [NSString stringWithString:@"Selected Contact:"]; myText.text = [myText.text stringByAppendingFormat:@"\n\n%@", (NSString *)ABRecordCopyCompositeName(thisPerson)];
UPC Code Printer In Objective-C
Using Barcode generator for iPhone Control to generate, create UPC A image in iPhone applications.
www.OnBarcode.com
Making QR Code 2d Barcode In Objective-C
Using Barcode creation for iPhone Control to generate, create QR-Code image in iPhone applications.
www.OnBarcode.com
Download from Wow! eBook <www.wowebook.com>
USS-128 Creator In Objective-C
Using Barcode creation for iPhone Control to generate, create EAN / UCC - 13 image in iPhone applications.
www.OnBarcode.com
Encoding EAN-13 Supplement 5 In Objective-C
Using Barcode printer for iPhone Control to generate, create European Article Number 13 image in iPhone applications.
www.OnBarcode.com
Data: advanced techniques
Create Barcode In Objective-C
Using Barcode creation for iPhone Control to generate, create Barcode image in iPhone applications.
www.OnBarcode.com
Encoding EAN-8 Supplement 5 Add-On In Objective-C
Using Barcode generation for iPhone Control to generate, create European Article Number 8 image in iPhone applications.
www.OnBarcode.com
CFStringRef thisJob = ABRecordCopyValue(thisPerson, kABPersonJobTitleProperty); CFStringRef thisOrg = ABRecordCopyValue(thisPerson, kABPersonOrganizationProperty); if (thisJob != NULL && thisOrg != NULL) { myText.text = [myText.text stringByAppendingFormat:@"\n%@ of %@",thisJob,thisOrg]; } ABMultiValueRef thisPhones = ABRecordCopyValue(thisPerson, kABPersonPhoneProperty); if (thisPhones != NULL) { for (int j = 0; j < ABMultiValueGetCount(thisPhones) ; j++) { myText.text = [myText.text stringByAppendingFormat:@"\n%@: %@", (NSString *)ABMultiValueCopyLabelAtIndex(thisPhones, j), (NSString *)ABMultiValueCopyValueAtIndex(thisPhones, j)]; } } myText.text = [myText.text stringByAppendingFormat:@"\n\nThere are %ld records and %ld groups in this address book.",abPCount,abGCount]; [self dismissModalViewControllerAnimated:YES]; return NO; } - (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier { return NO; } - (void)peoplePickerNavigationControllerDidCancel: (ABPeoplePickerNavigationController *) peoplePicker { [self dismissModalViewControllerAnimated:YES]; }
Encoding QR Code 2d Barcode In None
Using Barcode creator for Office Excel Control to generate, create Quick Response Code image in Excel applications.
www.OnBarcode.com
QR Code JIS X 0510 Drawer In .NET
Using Barcode creation for VS .NET Control to generate, create QR Code image in .NET framework applications.
www.OnBarcode.com
To instantiate a modal view controller, you follow three simple steps that are executed when the user clicks the appropriate button in the toolbar. You create the controller B, set its delegate C, and use UIViewController s presentModalViewController: animated: method to place it at the top of your user s screen D. You then don t have to worry about how the modal view controller looks or works; you just have to respond to the messages listed in the protocol reference. The fully featured interface that s available to you as soon as you pop up the controller is shown in figure 9.3. You do most of the work in the peoplePickerNavigationController:shouldContinueAfterSelectingPerson: method. This is called whenever a user selects an individual contact. Note that you can use a property of the peoplePicker variable to access the Address Book E, which allows you to use many of the ABAddressBook functions without needing to create the Address Book manually. Beyond that, the people picker sends you an ABRecordRef for the contact that the user selected; from there, you work with it exactly as you worked with the ABRecordRefs you looked up in listing 9.5.
Generate Data Matrix In Java
Using Barcode printer for Java Control to generate, create Data Matrix ECC200 image in Java applications.
www.OnBarcode.com
ANSI/AIM Code 39 Generator In None
Using Barcode drawer for Font Control to generate, create Code-39 image in Font applications.
www.OnBarcode.com
Download from Wow! eBook <www.wowebook.com>
Code 128C Generator In None
Using Barcode encoder for Microsoft Excel Control to generate, create Code 128 Code Set C image in Excel applications.
www.OnBarcode.com
Code-128 Creation In .NET Framework
Using Barcode generation for ASP.NET Control to generate, create Code 128 Code Set A image in ASP.NET applications.
www.OnBarcode.com
Accessing the Address Book
Creating DataMatrix In None
Using Barcode generator for Software Control to generate, create Data Matrix 2d barcode image in Software applications.
www.OnBarcode.com
Paint EAN128 In Java
Using Barcode printer for Android Control to generate, create EAN 128 image in Android applications.
www.OnBarcode.com
Figure 9.3 A people picker view controller shown on both the iPad and iPhone
Recognize Barcode In Visual Basic .NET
Using Barcode scanner for Visual Studio .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Drawing Code 3/9 In C#
Using Barcode maker for Visual Studio .NET Control to generate, create Code 39 Extended image in Visual Studio .NET applications.
www.OnBarcode.com
In this example, users can only select individual contacts, so when the method is done, you dismiss the modal view controller and then return NO, which tells the people picker that you don t want to take the standard action for selecting the contact (which would be to call up a subpage with all of that contact s properties). If you wanted to let a user select a specific property from within a contact, you d fill in the peoplePickerNavigationController:shouldContinueAfterSelectingPerson:property:identifier: method. The third method defined by the ABPeoplePickerNavigationController protocol is peoplePickerNavigationControllerDidCancel:, which here causes the program to (again) dismiss the people picker. You can do a little more with the people picker. As we already noted, you could have opted to let a user select an individual property by returning YES for the first shouldContinue method and then filling in the second one. You could also choose the individual properties that display on a contact page. Information on these possibilities is available in the ABPeoplePickerNavigationController and ABPeoplePickerNavigationControllerDelegate class references.
Scan QR In Java
Using Barcode scanner for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
EAN / UCC - 13 Decoder In Visual Studio .NET
Using Barcode scanner for .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
USING CORE FOUNDATION
The Address Book framework is the first framework you ve worked with that requires you to use Core Foundation, a non-Cocoa library. This means you have to program slightly differently, as we promised would be the case back in chapter 2. The biggest differences are how variables and memory allocation work.
Download from Wow! eBook <www.wowebook.com>
Data: advanced techniques
Core Foundation variables use different classes, such as CFStringRef replacing NSString *. Remember that the Core Foundation variable types usually have equivalents in Cocoa that you can freely switch between by casting, as is done in listing 9.5 when moving between the Address Book records and the UITextView text. When you re using the Core Foundation variables natively, you have to use Core Foundation functions, such as CFArrayCount, to deal with them. You also have to deal with memory management a little differently. Core Foundation memory management uses the same general approach as Cocoa Touch. There s a reference count for each object that s increased when it s created or retained and decreased when it s released. You have to remember slightly different rules for when you have a reference. If you create an object with a function using the word(s) create or copy, you own a reference to it and must CFRelease it. If you create an object in another way, you don t have a reference, and you must CFRetain the object if you want to keep it around. Some classes of objects may have their own release and retain functions. The Memory Management Programming Guide for Core Foundation tutorial at http://developer.apple.com has more information. Core Foundation will show up again in chapter 12, where it controls some audio services, and in chapter 13, where it s used for the Quartz 2D graphics package. You can use three other view controllers to allow users to interact with the Address Book, as we ll discuss next.
Copyright © OnBarcode.com . All rights reserved.