Permalink
Browse files

Added Chapter 18

  • Loading branch information...
1 parent 8f24661 commit b3533def7df5fb53bfa2748204664ac761b3b533 Erica Sadun committed Aug 21, 2009
Showing with 13,069 additions and 0 deletions.
  1. +1 −0 C18-Address Book/01-Helpers
  2. +101 −0 C18-Address Book/02-Display Contact/ABContact.h
  3. +525 −0 C18-Address Book/02-Display Contact/ABContact.m
  4. +47 −0 C18-Address Book/02-Display Contact/ABContactsHelper.h
  5. +133 −0 C18-Address Book/02-Display Contact/ABContactsHelper.m
  6. +33 −0 C18-Address Book/02-Display Contact/ABGroup.h
  7. +112 −0 C18-Address Book/02-Display Contact/ABGroup.m
  8. BIN C18-Address Book/02-Display Contact/Default.png
  9. +269 −0 C18-Address Book/02-Display Contact/HelloWorld.xcodeproj/project.pbxproj
  10. +8 −0 C18-Address Book/02-Display Contact/HelloWorld_Prefix.pch
  11. +26 −0 C18-Address Book/02-Display Contact/Info.plist
  12. +180 −0 C18-Address Book/02-Display Contact/TestBedViewController.xib
  13. BIN C18-Address Book/02-Display Contact/cover320x416.png
  14. +1 −0 C18-Address Book/02-Display Contact/docopy
  15. BIN C18-Address Book/02-Display Contact/icon.png
  16. +130 −0 C18-Address Book/02-Display Contact/main.m
  17. +101 −0 C18-Address Book/03-Images/ABContact.h
  18. +525 −0 C18-Address Book/03-Images/ABContact.m
  19. +47 −0 C18-Address Book/03-Images/ABContactsHelper.h
  20. +133 −0 C18-Address Book/03-Images/ABContactsHelper.m
  21. +33 −0 C18-Address Book/03-Images/ABGroup.h
  22. +112 −0 C18-Address Book/03-Images/ABGroup.m
  23. BIN C18-Address Book/03-Images/Default.png
  24. +269 −0 C18-Address Book/03-Images/HelloWorld.xcodeproj/project.pbxproj
  25. +8 −0 C18-Address Book/03-Images/HelloWorld_Prefix.pch
  26. +26 −0 C18-Address Book/03-Images/Info.plist
  27. +180 −0 C18-Address Book/03-Images/TestBedViewController.xib
  28. BIN C18-Address Book/03-Images/cover320x416.png
  29. +1 −0 C18-Address Book/03-Images/docopy
  30. BIN C18-Address Book/03-Images/icon.png
  31. +137 −0 C18-Address Book/03-Images/main.m
  32. +101 −0 C18-Address Book/04-People Picker/ABContact.h
  33. +525 −0 C18-Address Book/04-People Picker/ABContact.m
  34. +47 −0 C18-Address Book/04-People Picker/ABContactsHelper.h
  35. +133 −0 C18-Address Book/04-People Picker/ABContactsHelper.m
  36. +33 −0 C18-Address Book/04-People Picker/ABGroup.h
  37. +112 −0 C18-Address Book/04-People Picker/ABGroup.m
  38. BIN C18-Address Book/04-People Picker/Default.png
  39. +269 −0 C18-Address Book/04-People Picker/HelloWorld.xcodeproj/project.pbxproj
  40. +8 −0 C18-Address Book/04-People Picker/HelloWorld_Prefix.pch
  41. +26 −0 C18-Address Book/04-People Picker/Info.plist
  42. +223 −0 C18-Address Book/04-People Picker/TestBedViewController.xib
  43. BIN C18-Address Book/04-People Picker/cover320x416.png
  44. +1 −0 C18-Address Book/04-People Picker/docopy
  45. BIN C18-Address Book/04-People Picker/icon.png
  46. +95 −0 C18-Address Book/04-People Picker/main.m
  47. +101 −0 C18-Address Book/04b-Property Picker/ABContact.h
  48. +525 −0 C18-Address Book/04b-Property Picker/ABContact.m
  49. +47 −0 C18-Address Book/04b-Property Picker/ABContactsHelper.h
  50. +133 −0 C18-Address Book/04b-Property Picker/ABContactsHelper.m
  51. +33 −0 C18-Address Book/04b-Property Picker/ABGroup.h
  52. +112 −0 C18-Address Book/04b-Property Picker/ABGroup.m
  53. BIN C18-Address Book/04b-Property Picker/Default.png
  54. +269 −0 C18-Address Book/04b-Property Picker/HelloWorld.xcodeproj/project.pbxproj
  55. +8 −0 C18-Address Book/04b-Property Picker/HelloWorld_Prefix.pch
  56. +26 −0 C18-Address Book/04b-Property Picker/Info.plist
  57. +223 −0 C18-Address Book/04b-Property Picker/TestBedViewController.xib
  58. BIN C18-Address Book/04b-Property Picker/cover320x416.png
  59. +1 −0 C18-Address Book/04b-Property Picker/docopy
  60. BIN C18-Address Book/04b-Property Picker/icon.png
  61. +105 −0 C18-Address Book/04b-Property Picker/main.m
  62. +101 −0 C18-Address Book/05-Type Picker/ABContact.h
  63. +525 −0 C18-Address Book/05-Type Picker/ABContact.m
  64. +47 −0 C18-Address Book/05-Type Picker/ABContactsHelper.h
  65. +133 −0 C18-Address Book/05-Type Picker/ABContactsHelper.m
  66. +33 −0 C18-Address Book/05-Type Picker/ABGroup.h
  67. +112 −0 C18-Address Book/05-Type Picker/ABGroup.m
  68. BIN C18-Address Book/05-Type Picker/Default.png
  69. +269 −0 C18-Address Book/05-Type Picker/HelloWorld.xcodeproj/project.pbxproj
  70. +8 −0 C18-Address Book/05-Type Picker/HelloWorld_Prefix.pch
  71. +26 −0 C18-Address Book/05-Type Picker/Info.plist
  72. +223 −0 C18-Address Book/05-Type Picker/TestBedViewController.xib
  73. BIN C18-Address Book/05-Type Picker/cover320x416.png
  74. +1 −0 C18-Address Book/05-Type Picker/docopy
  75. BIN C18-Address Book/05-Type Picker/icon.png
  76. +105 −0 C18-Address Book/05-Type Picker/main.m
  77. +101 −0 C18-Address Book/06-New Contact/ABContact.h
  78. +525 −0 C18-Address Book/06-New Contact/ABContact.m
  79. +47 −0 C18-Address Book/06-New Contact/ABContactsHelper.h
  80. +133 −0 C18-Address Book/06-New Contact/ABContactsHelper.m
  81. +33 −0 C18-Address Book/06-New Contact/ABGroup.h
  82. +112 −0 C18-Address Book/06-New Contact/ABGroup.m
  83. BIN C18-Address Book/06-New Contact/Default.png
  84. +275 −0 C18-Address Book/06-New Contact/HelloWorld.xcodeproj/project.pbxproj
  85. +8 −0 C18-Address Book/06-New Contact/HelloWorld_Prefix.pch
  86. +26 −0 C18-Address Book/06-New Contact/Info.plist
  87. +15 −0 C18-Address Book/06-New Contact/ModalAlert.h
  88. +180 −0 C18-Address Book/06-New Contact/ModalAlert.m
  89. +223 −0 C18-Address Book/06-New Contact/TestBedViewController.xib
  90. BIN C18-Address Book/06-New Contact/cover320x416.png
  91. +1 −0 C18-Address Book/06-New Contact/docopy
  92. BIN C18-Address Book/06-New Contact/icon.png
  93. +139 −0 C18-Address Book/06-New Contact/main.m
  94. +101 −0 C18-Address Book/07-Modifying Contact/ABContact.h
  95. +525 −0 C18-Address Book/07-Modifying Contact/ABContact.m
  96. +47 −0 C18-Address Book/07-Modifying Contact/ABContactsHelper.h
  97. +133 −0 C18-Address Book/07-Modifying Contact/ABContactsHelper.m
  98. +33 −0 C18-Address Book/07-Modifying Contact/ABGroup.h
  99. +112 −0 C18-Address Book/07-Modifying Contact/ABGroup.m
  100. BIN C18-Address Book/07-Modifying Contact/Default.png
  101. +275 −0 C18-Address Book/07-Modifying Contact/HelloWorld.xcodeproj/project.pbxproj
  102. +8 −0 C18-Address Book/07-Modifying Contact/HelloWorld_Prefix.pch
  103. +26 −0 C18-Address Book/07-Modifying Contact/Info.plist
  104. +15 −0 C18-Address Book/07-Modifying Contact/ModalAlert.h
  105. +180 −0 C18-Address Book/07-Modifying Contact/ModalAlert.m
  106. +180 −0 C18-Address Book/07-Modifying Contact/TestBedViewController.xib
  107. BIN C18-Address Book/07-Modifying Contact/cover320x416.png
  108. +1 −0 C18-Address Book/07-Modifying Contact/docopy
  109. BIN C18-Address Book/07-Modifying Contact/icon.png
  110. +121 −0 C18-Address Book/07-Modifying Contact/main.m
  111. +1 −0 C18-Address Book/08-Groups
  112. +101 −0 C18-Address Book/09-Unknown Controller/ABContact.h
  113. +525 −0 C18-Address Book/09-Unknown Controller/ABContact.m
  114. +47 −0 C18-Address Book/09-Unknown Controller/ABContactsHelper.h
  115. +133 −0 C18-Address Book/09-Unknown Controller/ABContactsHelper.m
  116. +33 −0 C18-Address Book/09-Unknown Controller/ABGroup.h
  117. +112 −0 C18-Address Book/09-Unknown Controller/ABGroup.m
  118. BIN C18-Address Book/09-Unknown Controller/Default.png
  119. +269 −0 C18-Address Book/09-Unknown Controller/HelloWorld.xcodeproj/project.pbxproj
  120. +8 −0 C18-Address Book/09-Unknown Controller/HelloWorld_Prefix.pch
  121. +26 −0 C18-Address Book/09-Unknown Controller/Info.plist
  122. +223 −0 C18-Address Book/09-Unknown Controller/TestBedViewController.xib
  123. BIN C18-Address Book/09-Unknown Controller/cover320x416.png
  124. +1 −0 C18-Address Book/09-Unknown Controller/docopy
  125. BIN C18-Address Book/09-Unknown Controller/icon.png
  126. +107 −0 C18-Address Book/09-Unknown Controller/main.m
  127. +31 −0 C18-Address Book/update.pl
Submodule 01-Helpers added at 519a32
@@ -0,0 +1,101 @@
+/*
+ Erica Sadun, http://ericasadun.com
+ iPhone Developer's Cookbook, 3.0 Edition
+ BSD License, Use at your own risk
+ */
+
+#import <UIKit/UIKit.h>
+#import <AddressBook/AddressBook.h>
+#import <AddressBookUI/AddressBookUI.h>
+
+@interface ABContact : NSObject
+{
+ ABRecordRef record;
+}
+
+// Convenience allocation methods
++ (id) contact;
++ (id) contactWithRecord: (ABRecordRef) record;
++ (id) contactWithRecordID: (ABRecordID) recordID;
+
+// Class utility methods
++ (NSString *) localizedPropertyName: (ABPropertyID) aProperty;
++ (ABPropertyType) propertyType: (ABPropertyID) aProperty;
++ (NSString *) propertyTypeString: (ABPropertyID) aProperty;
++ (NSString *) propertyString: (ABPropertyID) aProperty;
++ (BOOL) propertyIsMultivalue: (ABPropertyID) aProperty;
++ (NSArray *) arrayForProperty: (ABPropertyID) anID inRecord: (ABRecordRef) record;
++ (id) objectForProperty: (ABPropertyID) anID inRecord: (ABRecordRef) record;
+
+// Creating proper dictionaries
++ (NSDictionary *) dictionaryWithValue: (id) value andLabel: (CFStringRef) label;
++ (NSDictionary *) addressWithStreet: (NSString *) street withCity: (NSString *) city
+ withState:(NSString *) state withZip: (NSString *) zip
+ withCountry: (NSString *) country withCode: (NSString *) code;
++ (NSDictionary *) smsWithService: (CFStringRef) service andUser: (NSString *) userName;
+
+// Instance utility methods
+- (BOOL) removeSelfFromAddressBook: (NSError **) error;
+
+@property (nonatomic, readonly) ABRecordRef record;
+@property (nonatomic, readonly) ABRecordID recordID;
+@property (nonatomic, readonly) ABRecordType recordType;
+@property (nonatomic, readonly) BOOL isPerson;
+
+#pragma mark SINGLE VALUE STRING
+@property (nonatomic, assign) NSString *firstname;
+@property (nonatomic, assign) NSString *lastname;
+@property (nonatomic, assign) NSString *middlename;
+@property (nonatomic, assign) NSString *prefix;
+@property (nonatomic, assign) NSString *suffix;
+@property (nonatomic, assign) NSString *nickname;
+@property (nonatomic, assign) NSString *firstnamephonetic;
+@property (nonatomic, assign) NSString *lastnamephonetic;
+@property (nonatomic, assign) NSString *middlenamephonetic;
+@property (nonatomic, assign) NSString *organization;
+@property (nonatomic, assign) NSString *jobtitle;
+@property (nonatomic, assign) NSString *department;
+@property (nonatomic, assign) NSString *note;
+
+@property (nonatomic, readonly) NSString *contactName; // my friendly utility
+@property (nonatomic, readonly) NSString *compositeName; // via AB
+
+#pragma mark DATE
+@property (nonatomic, assign) NSDate *birthday;
+@property (nonatomic, readonly) NSDate *creationDate;
+@property (nonatomic, readonly) NSDate *modificationDate;
+
+#pragma mark MULTIVALUE
+// Each of these produces an array of NSStrings
+@property (nonatomic, readonly) NSArray *emailArray;
+@property (nonatomic, readonly) NSArray *emailLabels;
+@property (nonatomic, readonly) NSArray *phoneArray;
+@property (nonatomic, readonly) NSArray *phoneLabels;
+@property (nonatomic, readonly) NSArray *relatedNameArray;
+@property (nonatomic, readonly) NSArray *relatedNameLabels;
+@property (nonatomic, readonly) NSArray *urlArray;
+@property (nonatomic, readonly) NSArray *urlLabels;
+@property (nonatomic, readonly) NSArray *dateArray;
+@property (nonatomic, readonly) NSArray *dateLabels;
+@property (nonatomic, readonly) NSArray *addressArray;
+@property (nonatomic, readonly) NSArray *addressLabels;
+@property (nonatomic, readonly) NSArray *smsArray;
+@property (nonatomic, readonly) NSArray *smsLabels;
+
+@property (nonatomic, readonly) NSString *emailaddresses;
+@property (nonatomic, readonly) NSString *phonenumbers;
+@property (nonatomic, readonly) NSString *urls;
+
+// Each of these uses an array of dictionaries
+@property (nonatomic, assign) NSArray *emailDictionaries;
+@property (nonatomic, assign) NSArray *phoneDictionaries;
+@property (nonatomic, assign) NSArray *relatedNameDictionaries;
+@property (nonatomic, assign) NSArray *urlDictionaries;
+@property (nonatomic, assign) NSArray *dateDictionaries;
+@property (nonatomic, assign) NSArray *addressDictionaries;
+@property (nonatomic, assign) NSArray *smsDictionaries;
+
+#pragma mark IMAGES
+@property (nonatomic, assign) UIImage *image;
+
+@end
Oops, something went wrong.

0 comments on commit b3533de

Please sign in to comment.