Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don’t worry, you can still create the pull request.
  • 13 commits
  • 20 files changed
  • 0 commit comments
  • 1 contributor
View
BIN Resources/SSToolkit.bundle/images/ABPictureOrganization.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN Resources/SSToolkit.bundle/images/ABPictureOrganization@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN Resources/SSToolkit.bundle/images/ABPicturePerson.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN Resources/SSToolkit.bundle/images/ABPicturePerson@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
19 SSCatalog/Classes/SCPersonDemoViewController.h
@@ -0,0 +1,19 @@
+//
+// SCPersonDemoViewController.h
+// SSCatalog
+//
+// Created by Sam Soffes on 9/8/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+#import <AddressBookUI/AddressBookUI.h>
+
+@interface SCPersonDemoViewController : UIViewController <ABPeoplePickerNavigationControllerDelegate> {
+
+}
+
++ (NSString *)title;
+
+- (void)pickPerson:(id)sender;
+
+@end
View
76 SSCatalog/Classes/SCPersonDemoViewController.m
@@ -0,0 +1,76 @@
+//
+// SCPersonDemoViewController.m
+// SSCatalog
+//
+// Created by Sam Soffes on 9/8/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+#import "SCPersonDemoViewController.h"
+#import <SSToolkit/SSPersonViewController.h>
+
+@implementation SCPersonDemoViewController
+
+#pragma mark Class Methods
+
++ (NSString *)title {
+ return @"People";
+}
+
+
+#pragma mark UIViewController
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ self.title = [[self class] title];
+ self.view.backgroundColor = [UIColor whiteColor];
+
+ UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
+ button.frame = CGRectMake(20.0, 20.0, 280.0, 37.0);
+ [button setTitle:@"Pick Person" forState:UIControlStateNormal];
+ [button addTarget:self action:@selector(pickPerson:) forControlEvents:UIControlEventTouchUpInside];
+ [self.view addSubview:button];
+}
+
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
+ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
+ return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
+ }
+ return YES;
+}
+
+
+#pragma mark Actions
+
+- (void)pickPerson:(id)sender {
+ ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
+ picker.peoplePickerDelegate = self;
+ [self.navigationController presentModalViewController:picker animated:YES];
+ [picker release];
+}
+
+
+#pragma mark ABPeoplePickerNavigationControllerDelegate
+
+- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {
+ [self.navigationController dismissModalViewControllerAnimated:YES];
+
+ SSPersonViewController *personViewController = [[SSPersonViewController alloc] initWithPerson:person addressBook:peoplePicker.addressBook];
+ [self.navigationController pushViewController:personViewController animated:YES];
+ [personViewController release];
+
+ return NO;
+}
+
+
+- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
+ return NO;
+}
+
+
+- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {
+ [self.navigationController dismissModalViewControllerAnimated:YES];
+}
+
+@end
View
4 SSCatalog/Classes/SCRootViewController.m
@@ -7,8 +7,7 @@
//
#import "SCRootViewController.h"
-#import "SCPickerDemoViewController.h"
-#import "SCGradientViewDemoViewController.h"
+#import "SCCollectionViewDemoViewController.h"
static NSString *const kTitleKey = @"title";
static NSString *const kClassesKey = @"classes";
@@ -49,6 +48,7 @@ - (void)viewDidLoad {
nil],
[NSDictionary dictionaryWithObjectsAndKeys:
[NSArray arrayWithObjects:
+ @"SCPersonDemoViewController",
@"SCPickerDemoViewController",
@"SCMessagesDemoViewController",
nil],
View
105 SSCatalog/SSCatalog.xcodeproj/project.pbxproj
@@ -7,13 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
- 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
- 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
- 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
- B21B85B81067D4B500E5C076 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B21B85B71067D4B500E5C076 /* SystemConfiguration.framework */; };
B21B85BE1067D4F300E5C076 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B21B85BC1067D4F300E5C076 /* main.m */; };
- B21B86441067D7EA00E5C076 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B21B86431067D7EA00E5C076 /* libsqlite3.dylib */; };
- B24521CD1211AF2800E80F78 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B24521CC1211AF2800E80F78 /* Security.framework */; };
B24E9EAA121DC35B0085F81E /* SCAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9E99121DC35B0085F81E /* SCAppDelegate.m */; };
B24E9EAB121DC35B0085F81E /* SCGradientViewDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9E9B121DC35B0085F81E /* SCGradientViewDemoViewController.m */; };
B24E9EAC121DC35B0085F81E /* SCHUDViewDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9E9D121DC35B0085F81E /* SCHUDViewDemoViewController.m */; };
@@ -24,6 +18,7 @@
B24E9EB1121DC35B0085F81E /* SCPieProgressViewDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9EA7121DC35B0085F81E /* SCPieProgressViewDemoViewController.m */; };
B24E9EB2121DC35B0085F81E /* SCRootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9EA9121DC35B0085F81E /* SCRootViewController.m */; };
B24E9EB7121DC3760085F81E /* SSToolkit.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B24E9EB6121DC3760085F81E /* SSToolkit.bundle */; };
+ B25EE40B1238844700FDA801 /* SCPersonDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B25EE40A1238844700FDA801 /* SCPersonDemoViewController.m */; };
B27B1A581224228000111EA2 /* SCCollectionViewDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B27B1A571224228000111EA2 /* SCCollectionViewDemoViewController.m */; };
B27B1C2C12248A6F00111EA2 /* SSToolkit.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B24E9EB6121DC3760085F81E /* SSToolkit.bundle */; };
B27B1C3012248A6F00111EA2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B21B85BC1067D4F300E5C076 /* main.m */; };
@@ -37,12 +32,6 @@
B27B1C3812248A6F00111EA2 /* SCPieProgressViewDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9EA7121DC35B0085F81E /* SCPieProgressViewDemoViewController.m */; };
B27B1C3912248A6F00111EA2 /* SCRootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9EA9121DC35B0085F81E /* SCRootViewController.m */; };
B27B1C3A12248A6F00111EA2 /* SCCollectionViewDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B27B1A571224228000111EA2 /* SCCollectionViewDemoViewController.m */; };
- B27B1C3C12248A6F00111EA2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
- B27B1C3D12248A6F00111EA2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
- B27B1C3E12248A6F00111EA2 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
- B27B1C3F12248A6F00111EA2 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B21B85B71067D4B500E5C076 /* SystemConfiguration.framework */; };
- B27B1C4012248A6F00111EA2 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B21B86431067D7EA00E5C076 /* libsqlite3.dylib */; };
- B27B1C4112248A6F00111EA2 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B24521CC1211AF2800E80F78 /* Security.framework */; };
B27B1C4212248A6F00111EA2 /* libTWToolkit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B24E9ECA121DC3CF0085F81E /* libTWToolkit.a */; };
B27B1CD012248F9D00111EA2 /* Default-Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = B27B1CC612248F9D00111EA2 /* Default-Landscape.png */; };
B27B1CD112248F9D00111EA2 /* Default-Landscape@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B27B1CC712248F9D00111EA2 /* Default-Landscape@2x.png */; };
@@ -63,6 +52,19 @@
B27B1CE112248F9D00111EA2 /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = B27B1CCD12248F9D00111EA2 /* Icon-114.png */; };
B27B1CE212248F9D00111EA2 /* iTunesArtwork in Resources */ = {isa = PBXBuildFile; fileRef = B27B1CCE12248F9D00111EA2 /* iTunesArtwork */; };
B2E0323F121DC49700D02434 /* libTWToolkit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B24E9ECA121DC3CF0085F81E /* libTWToolkit.a */; };
+ B2ED469C123D9A38007FBC4C /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2ED469B123D9A38007FBC4C /* AddressBook.framework */; };
+ B2ED469E123D9A38007FBC4C /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2ED469D123D9A38007FBC4C /* AddressBookUI.framework */; };
+ B2ED46A0123D9A38007FBC4C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2ED469F123D9A38007FBC4C /* CoreGraphics.framework */; };
+ B2ED46A2123D9A38007FBC4C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2ED46A1123D9A38007FBC4C /* Security.framework */; };
+ B2ED46A4123D9A38007FBC4C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2ED46A3123D9A38007FBC4C /* UIKit.framework */; };
+ B2ED46B6123D9A53007FBC4C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2ED46B5123D9A53007FBC4C /* Foundation.framework */; };
+ B2ED479A123D9A6D007FBC4C /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2ED4799123D9A6D007FBC4C /* AddressBook.framework */; };
+ B2ED479C123D9A6D007FBC4C /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2ED479B123D9A6D007FBC4C /* AddressBookUI.framework */; };
+ B2ED479E123D9A6D007FBC4C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2ED479D123D9A6D007FBC4C /* CoreGraphics.framework */; };
+ B2ED47A0123D9A6D007FBC4C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2ED479F123D9A6D007FBC4C /* Foundation.framework */; };
+ B2ED47A2123D9A6D007FBC4C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2ED47A1123D9A6D007FBC4C /* Security.framework */; };
+ B2ED47A4123D9A6D007FBC4C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2ED47A3123D9A6D007FBC4C /* UIKit.framework */; };
+ B2ED47B9123D9AA7007FBC4C /* SCPersonDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B25EE40A1238844700FDA801 /* SCPersonDemoViewController.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -90,14 +92,8 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
- 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
1D6058910D05DD3D006BFB54 /* SSCatalog.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SSCatalog.app; sourceTree = BUILT_PRODUCTS_DIR; };
- 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
- 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
- B21B85B71067D4B500E5C076 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
B21B85BC1067D4F300E5C076 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
- B21B86431067D7EA00E5C076 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; };
- B24521CC1211AF2800E80F78 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = iphoneos3.0/System/Library/Frameworks/Security.framework; sourceTree = "<group>"; };
B24E9E98121DC35B0085F81E /* SCAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCAppDelegate.h; sourceTree = "<group>"; };
B24E9E99121DC35B0085F81E /* SCAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCAppDelegate.m; sourceTree = "<group>"; };
B24E9E9A121DC35B0085F81E /* SCGradientViewDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCGradientViewDemoViewController.h; sourceTree = "<group>"; };
@@ -119,6 +115,8 @@
B24E9EB3121DC3610085F81E /* SSCatalog_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSCatalog_Prefix.pch; sourceTree = "<group>"; };
B24E9EB6121DC3760085F81E /* SSToolkit.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = SSToolkit.bundle; path = ../Resources/SSToolkit.bundle; sourceTree = SOURCE_ROOT; };
B24E9EC5121DC3CF0085F81E /* SSToolkit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SSToolkit.xcodeproj; path = ../SSToolkit.xcodeproj; sourceTree = SOURCE_ROOT; };
+ B25EE4091238844700FDA801 /* SCPersonDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCPersonDemoViewController.h; sourceTree = "<group>"; };
+ B25EE40A1238844700FDA801 /* SCPersonDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCPersonDemoViewController.m; sourceTree = "<group>"; };
B27B1A561224228000111EA2 /* SCCollectionViewDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SCCollectionViewDemoViewController.h; sourceTree = "<group>"; };
B27B1A571224228000111EA2 /* SCCollectionViewDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SCCollectionViewDemoViewController.m; sourceTree = "<group>"; };
B27B1C4612248A6F00111EA2 /* SSCatalog.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SSCatalog.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -132,6 +130,18 @@
B27B1CCD12248F9D00111EA2 /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-114.png"; sourceTree = "<group>"; };
B27B1CCE12248F9D00111EA2 /* iTunesArtwork */ = {isa = PBXFileReference; lastKnownFileType = file; path = iTunesArtwork; sourceTree = "<group>"; };
B27B1CCF12248F9D00111EA2 /* SSCatalog-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "SSCatalog-Info.plist"; sourceTree = "<group>"; };
+ B2ED469B123D9A38007FBC4C /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
+ B2ED469D123D9A38007FBC4C /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; };
+ B2ED469F123D9A38007FBC4C /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ B2ED46A1123D9A38007FBC4C /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
+ B2ED46A3123D9A38007FBC4C /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ B2ED46B5123D9A53007FBC4C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ B2ED4799123D9A6D007FBC4C /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
+ B2ED479B123D9A6D007FBC4C /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; };
+ B2ED479D123D9A6D007FBC4C /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ B2ED479F123D9A6D007FBC4C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ B2ED47A1123D9A6D007FBC4C /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
+ B2ED47A3123D9A6D007FBC4C /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -139,13 +149,13 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
- 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
- 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */,
- B21B85B81067D4B500E5C076 /* SystemConfiguration.framework in Frameworks */,
- B21B86441067D7EA00E5C076 /* libsqlite3.dylib in Frameworks */,
- B24521CD1211AF2800E80F78 /* Security.framework in Frameworks */,
B2E0323F121DC49700D02434 /* libTWToolkit.a in Frameworks */,
+ B2ED469C123D9A38007FBC4C /* AddressBook.framework in Frameworks */,
+ B2ED469E123D9A38007FBC4C /* AddressBookUI.framework in Frameworks */,
+ B2ED46A0123D9A38007FBC4C /* CoreGraphics.framework in Frameworks */,
+ B2ED46A2123D9A38007FBC4C /* Security.framework in Frameworks */,
+ B2ED46A4123D9A38007FBC4C /* UIKit.framework in Frameworks */,
+ B2ED46B6123D9A53007FBC4C /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -153,13 +163,13 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- B27B1C3C12248A6F00111EA2 /* Foundation.framework in Frameworks */,
- B27B1C3D12248A6F00111EA2 /* UIKit.framework in Frameworks */,
- B27B1C3E12248A6F00111EA2 /* CoreGraphics.framework in Frameworks */,
- B27B1C3F12248A6F00111EA2 /* SystemConfiguration.framework in Frameworks */,
- B27B1C4012248A6F00111EA2 /* libsqlite3.dylib in Frameworks */,
- B27B1C4112248A6F00111EA2 /* Security.framework in Frameworks */,
B27B1C4212248A6F00111EA2 /* libTWToolkit.a in Frameworks */,
+ B2ED479A123D9A6D007FBC4C /* AddressBook.framework in Frameworks */,
+ B2ED479C123D9A6D007FBC4C /* AddressBookUI.framework in Frameworks */,
+ B2ED479E123D9A6D007FBC4C /* CoreGraphics.framework in Frameworks */,
+ B2ED47A0123D9A6D007FBC4C /* Foundation.framework in Frameworks */,
+ B2ED47A2123D9A6D007FBC4C /* Security.framework in Frameworks */,
+ B2ED47A4123D9A6D007FBC4C /* UIKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -201,12 +211,18 @@
isa = PBXGroup;
children = (
B24E9EC5121DC3CF0085F81E /* SSToolkit.xcodeproj */,
- B21B86431067D7EA00E5C076 /* libsqlite3.dylib */,
- B21B85B71067D4B500E5C076 /* SystemConfiguration.framework */,
- 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
- 1D30AB110D05D00D00671497 /* Foundation.framework */,
- 288765FC0DF74451002DB57D /* CoreGraphics.framework */,
- B24521CC1211AF2800E80F78 /* Security.framework */,
+ B2ED469B123D9A38007FBC4C /* AddressBook.framework */,
+ B2ED469D123D9A38007FBC4C /* AddressBookUI.framework */,
+ B2ED469F123D9A38007FBC4C /* CoreGraphics.framework */,
+ B2ED46B5123D9A53007FBC4C /* Foundation.framework */,
+ B2ED46A1123D9A38007FBC4C /* Security.framework */,
+ B2ED46A3123D9A38007FBC4C /* UIKit.framework */,
+ B2ED4799123D9A6D007FBC4C /* AddressBook.framework */,
+ B2ED479B123D9A6D007FBC4C /* AddressBookUI.framework */,
+ B2ED479D123D9A6D007FBC4C /* CoreGraphics.framework */,
+ B2ED479F123D9A6D007FBC4C /* Foundation.framework */,
+ B2ED47A1123D9A6D007FBC4C /* Security.framework */,
+ B2ED47A3123D9A6D007FBC4C /* UIKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -277,6 +293,8 @@
B27B1B0412246B6100111EA2 /* View Controller Demos */ = {
isa = PBXGroup;
children = (
+ B25EE4091238844700FDA801 /* SCPersonDemoViewController.h */,
+ B25EE40A1238844700FDA801 /* SCPersonDemoViewController.m */,
B24E9EA2121DC35B0085F81E /* SCPickerDemoViewController.h */,
B24E9EA3121DC35B0085F81E /* SCPickerDemoViewController.m */,
B24E9EA4121DC35B0085F81E /* SCPickerDetailViewController.h */,
@@ -336,7 +354,14 @@
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SSCatalog" */;
compatibilityVersion = "Xcode 3.1";
+ developmentRegion = English;
hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
projectReferences = (
@@ -416,6 +441,7 @@
B24E9EB1121DC35B0085F81E /* SCPieProgressViewDemoViewController.m in Sources */,
B24E9EB2121DC35B0085F81E /* SCRootViewController.m in Sources */,
B27B1A581224228000111EA2 /* SCCollectionViewDemoViewController.m in Sources */,
+ B25EE40B1238844700FDA801 /* SCPersonDemoViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -434,6 +460,7 @@
B27B1C3812248A6F00111EA2 /* SCPieProgressViewDemoViewController.m in Sources */,
B27B1C3912248A6F00111EA2 /* SCRootViewController.m in Sources */,
B27B1C3A12248A6F00111EA2 /* SCCollectionViewDemoViewController.m in Sources */,
+ B2ED47B9123D9AA7007FBC4C /* SCPersonDemoViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -469,6 +496,7 @@
"-all_load",
);
PRODUCT_NAME = SSCatalog;
+ SDKROOT = iphoneos4.0;
};
name = Debug;
};
@@ -486,6 +514,7 @@
"-all_load",
);
PRODUCT_NAME = SSCatalog;
+ SDKROOT = iphoneos4.0;
};
name = Release;
};
@@ -500,7 +529,7 @@
GCC_PREFIX_HEADER = "Other Sources/SSCatalog_Prefix.pch";
HEADER_SEARCH_PATHS = ../;
INFOPLIST_FILE = "Resources/SSCatalog-Info.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 4.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
OTHER_LDFLAGS = (
"-ObjC",
"-all_load",
@@ -520,7 +549,7 @@
GCC_PREFIX_HEADER = "Other Sources/TWCatalog_Prefix.pch";
HEADER_SEARCH_PATHS = ../;
INFOPLIST_FILE = "Resources/SSCatalog-Info.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 4.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
OTHER_LDFLAGS = (
"-ObjC",
"-all_load",
View
50 SSToolkit.xcodeproj/project.pbxproj
@@ -74,14 +74,25 @@
B24E9E7E121DC29A0085F81E /* UIView+SSToolkitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9E40121DC29A0085F81E /* UIView+SSToolkitAdditions.m */; };
B24E9E7F121DC29A0085F81E /* UIViewController+SSToolkitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = B24E9E41121DC29A0085F81E /* UIViewController+SSToolkitAdditions.h */; };
B24E9E80121DC29A0085F81E /* UIViewController+SSToolkitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = B24E9E42121DC29A0085F81E /* UIViewController+SSToolkitAdditions.m */; };
+ B25EE3FD123883C200FDA801 /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B25EE3FC123883C200FDA801 /* AddressBook.framework */; };
+ B25EE401123883D100FDA801 /* SSPersonViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = B25EE3FF123883D100FDA801 /* SSPersonViewController.h */; };
+ B25EE402123883D100FDA801 /* SSPersonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B25EE400123883D100FDA801 /* SSPersonViewController.m */; };
+ B25EE4531238883400FDA801 /* SSPersonHeaderView.h in Headers */ = {isa = PBXBuildFile; fileRef = B25EE4511238883400FDA801 /* SSPersonHeaderView.h */; };
+ B25EE4541238883400FDA801 /* SSPersonHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = B25EE4521238883400FDA801 /* SSPersonHeaderView.m */; };
B267D3451226CE0400B66519 /* SSCollectionViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = B267D3431226CE0400B66519 /* SSCollectionViewController.h */; };
B267D3461226CE0400B66519 /* SSCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B267D3441226CE0400B66519 /* SSCollectionViewController.m */; };
B27B1A1B12241D3400111EA2 /* SSCollectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = B27B1A1912241D3400111EA2 /* SSCollectionView.h */; };
B27B1A1C12241D3400111EA2 /* SSCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = B27B1A1A12241D3400111EA2 /* SSCollectionView.m */; };
B27B1A2212241D6F00111EA2 /* SSCollectionViewItem.h in Headers */ = {isa = PBXBuildFile; fileRef = B27B1A2012241D6F00111EA2 /* SSCollectionViewItem.h */; };
B27B1A2312241D6F00111EA2 /* SSCollectionViewItem.m in Sources */ = {isa = PBXBuildFile; fileRef = B27B1A2112241D6F00111EA2 /* SSCollectionViewItem.m */; };
+ B29AF6A012430E5600649B0A /* SSPersonFooterView.h in Headers */ = {isa = PBXBuildFile; fileRef = B29AF69E12430E5600649B0A /* SSPersonFooterView.h */; };
+ B29AF6A112430E5600649B0A /* SSPersonFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = B29AF69F12430E5600649B0A /* SSPersonFooterView.m */; };
+ B29AF7391243125200649B0A /* SSEditPersonViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = B29AF7371243125200649B0A /* SSEditPersonViewController.h */; };
+ B29AF73A1243125200649B0A /* SSEditPersonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B29AF7381243125200649B0A /* SSEditPersonViewController.m */; };
B2E03770121DCCB500D02434 /* SSTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E0376E121DCCB500D02434 /* SSTableViewCell.h */; };
B2E03771121DCCB500D02434 /* SSTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E0376F121DCCB500D02434 /* SSTableViewCell.m */; };
+ B2ED4833123DA1CB007FBC4C /* SSPersonAddressTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = B2ED4831123DA1CB007FBC4C /* SSPersonAddressTableViewCell.h */; };
+ B2ED4834123DA1CB007FBC4C /* SSPersonAddressTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B2ED4832123DA1CB007FBC4C /* SSPersonAddressTableViewCell.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -153,14 +164,25 @@
B24E9E40121DC29A0085F81E /* UIView+SSToolkitAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+SSToolkitAdditions.m"; sourceTree = "<group>"; };
B24E9E41121DC29A0085F81E /* UIViewController+SSToolkitAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+SSToolkitAdditions.h"; sourceTree = "<group>"; };
B24E9E42121DC29A0085F81E /* UIViewController+SSToolkitAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+SSToolkitAdditions.m"; sourceTree = "<group>"; };
+ B25EE3FC123883C200FDA801 /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = iphoneos3.0/System/Library/Frameworks/AddressBook.framework; sourceTree = "<group>"; };
+ B25EE3FF123883D100FDA801 /* SSPersonViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSPersonViewController.h; sourceTree = "<group>"; };
+ B25EE400123883D100FDA801 /* SSPersonViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSPersonViewController.m; sourceTree = "<group>"; };
+ B25EE4511238883400FDA801 /* SSPersonHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSPersonHeaderView.h; sourceTree = "<group>"; };
+ B25EE4521238883400FDA801 /* SSPersonHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSPersonHeaderView.m; sourceTree = "<group>"; };
B267D3431226CE0400B66519 /* SSCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSCollectionViewController.h; sourceTree = "<group>"; };
B267D3441226CE0400B66519 /* SSCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSCollectionViewController.m; sourceTree = "<group>"; };
B27B1A1912241D3400111EA2 /* SSCollectionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSCollectionView.h; sourceTree = "<group>"; };
B27B1A1A12241D3400111EA2 /* SSCollectionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSCollectionView.m; sourceTree = "<group>"; };
B27B1A2012241D6F00111EA2 /* SSCollectionViewItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSCollectionViewItem.h; sourceTree = "<group>"; };
B27B1A2112241D6F00111EA2 /* SSCollectionViewItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSCollectionViewItem.m; sourceTree = "<group>"; };
+ B29AF69E12430E5600649B0A /* SSPersonFooterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSPersonFooterView.h; sourceTree = "<group>"; };
+ B29AF69F12430E5600649B0A /* SSPersonFooterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSPersonFooterView.m; sourceTree = "<group>"; };
+ B29AF7371243125200649B0A /* SSEditPersonViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSEditPersonViewController.h; sourceTree = "<group>"; };
+ B29AF7381243125200649B0A /* SSEditPersonViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSEditPersonViewController.m; sourceTree = "<group>"; };
B2E0376E121DCCB500D02434 /* SSTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSTableViewCell.h; sourceTree = "<group>"; };
B2E0376F121DCCB500D02434 /* SSTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSTableViewCell.m; sourceTree = "<group>"; };
+ B2ED4831123DA1CB007FBC4C /* SSPersonAddressTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSPersonAddressTableViewCell.h; sourceTree = "<group>"; };
+ B2ED4832123DA1CB007FBC4C /* SSPersonAddressTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSPersonAddressTableViewCell.m; sourceTree = "<group>"; };
D2AAC07E0554694100DB518D /* libTWToolkit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTWToolkit.a; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
@@ -172,6 +194,7 @@
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */,
B21504CA10583B4000409ED4 /* SystemConfiguration.framework in Frameworks */,
B215051210583BBB00409ED4 /* UIKit.framework in Frameworks */,
+ B25EE3FD123883C200FDA801 /* AddressBook.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -201,6 +224,7 @@
0867D69AFE84028FC02AAC07 /* Frameworks */ = {
isa = PBXGroup;
children = (
+ B25EE3FC123883C200FDA801 /* AddressBook.framework */,
AACBBE490F95108600F1A2B1 /* Foundation.framework */,
B21504C910583B4000409ED4 /* SystemConfiguration.framework */,
B215051110583BBB00409ED4 /* UIKit.framework */,
@@ -322,6 +346,8 @@
B24E9E21121DC29A0085F81E /* SSMessagesViewController.h */,
B24E9E22121DC29A0085F81E /* SSMessagesViewController.m */,
B24E9E27121DC29A0085F81E /* SSModalViewController.h */,
+ B25EE3FF123883D100FDA801 /* SSPersonViewController.h */,
+ B25EE400123883D100FDA801 /* SSPersonViewController.m */,
B24E9E28121DC29A0085F81E /* SSPickerViewController.h */,
B24E9E29121DC29A0085F81E /* SSPickerViewController.m */,
B24E9E31121DC29A0085F81E /* SSViewController.h */,
@@ -370,6 +396,14 @@
children = (
B24E9E25121DC29A0085F81E /* SSMessageTableViewCellBubbleView.h */,
B24E9E26121DC29A0085F81E /* SSMessageTableViewCellBubbleView.m */,
+ B25EE4511238883400FDA801 /* SSPersonHeaderView.h */,
+ B25EE4521238883400FDA801 /* SSPersonHeaderView.m */,
+ B29AF69E12430E5600649B0A /* SSPersonFooterView.h */,
+ B29AF69F12430E5600649B0A /* SSPersonFooterView.m */,
+ B2ED4831123DA1CB007FBC4C /* SSPersonAddressTableViewCell.h */,
+ B2ED4832123DA1CB007FBC4C /* SSPersonAddressTableViewCell.m */,
+ B29AF7371243125200649B0A /* SSEditPersonViewController.h */,
+ B29AF7381243125200649B0A /* SSEditPersonViewController.m */,
);
name = Private;
sourceTree = "<group>";
@@ -419,6 +453,11 @@
B27B1A1B12241D3400111EA2 /* SSCollectionView.h in Headers */,
B27B1A2212241D6F00111EA2 /* SSCollectionViewItem.h in Headers */,
B267D3451226CE0400B66519 /* SSCollectionViewController.h in Headers */,
+ B25EE401123883D100FDA801 /* SSPersonViewController.h in Headers */,
+ B25EE4531238883400FDA801 /* SSPersonHeaderView.h in Headers */,
+ B2ED4833123DA1CB007FBC4C /* SSPersonAddressTableViewCell.h in Headers */,
+ B29AF6A012430E5600649B0A /* SSPersonFooterView.h in Headers */,
+ B29AF7391243125200649B0A /* SSEditPersonViewController.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -509,6 +548,11 @@
B27B1A1C12241D3400111EA2 /* SSCollectionView.m in Sources */,
B27B1A2312241D6F00111EA2 /* SSCollectionViewItem.m in Sources */,
B267D3461226CE0400B66519 /* SSCollectionViewController.m in Sources */,
+ B25EE402123883D100FDA801 /* SSPersonViewController.m in Sources */,
+ B25EE4541238883400FDA801 /* SSPersonHeaderView.m in Sources */,
+ B2ED4834123DA1CB007FBC4C /* SSPersonAddressTableViewCell.m in Sources */,
+ B29AF6A112430E5600649B0A /* SSPersonFooterView.m in Sources */,
+ B29AF73A1243125200649B0A /* SSEditPersonViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -519,7 +563,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
COPY_PHASE_STRIP = NO;
DSTROOT = /tmp/TWToolkit.dst;
GCC_DYNAMIC_NO_PIC = NO;
@@ -532,7 +575,7 @@
INSTALL_PATH = /usr/local/lib;
LD_OPENMP_FLAGS = "-fopenmp -lxml2";
PRODUCT_NAME = TWToolkit;
- SDKROOT = iphoneos3.2;
+ SDKROOT = iphoneos4.1;
};
name = Debug;
};
@@ -540,7 +583,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
DSTROOT = /tmp/TWToolkit.dst;
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -549,7 +591,7 @@
INSTALL_PATH = /usr/local/lib;
LD_OPENMP_FLAGS = "-fopenmp -lxml2";
PRODUCT_NAME = TWToolkit;
- SDKROOT = iphoneos3.2;
+ SDKROOT = iphoneos4.1;
};
name = Release;
};
View
17 SSToolkit/SSEditPersonViewController.h
@@ -0,0 +1,17 @@
+//
+// SSEditPersonViewController.h
+// SSToolkit
+//
+// Created by Sam Soffes on 9/16/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+#import <AddressBookUI/AddressBookUI.h>
+
+@interface SSEditPersonViewController : ABPersonViewController {
+
+}
+
+- (void)cancel:(id)sender;
+
+@end
View
55 SSToolkit/SSEditPersonViewController.m
@@ -0,0 +1,55 @@
+//
+// SSEditPersonViewController.m
+// SSToolkit
+//
+// Created by Sam Soffes on 9/16/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+#import "SSEditPersonViewController.h"
+
+@implementation SSEditPersonViewController
+
+#pragma mark NSObject
+
+- (id)init {
+ if ((self = [super init])) {
+ self.allowsEditing = YES;
+ self.editing = YES;
+ }
+ return self;
+}
+
+
+#pragma mark UIViewController
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+
+ self.title = @"Edit Contact";
+
+ UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel:)];
+ self.navigationItem.leftBarButtonItem = cancelButton;
+ [cancelButton release];
+}
+
+
+#pragma mark UITableViewController
+
+- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
+ [super setEditing:editing animated:animated];
+ if (editing == NO) {
+ ABAddressBookSave(self.addressBook, nil);
+
+ [self dismissModalViewControllerAnimated:YES];
+ }
+}
+
+
+#pragma mark Actions
+
+- (void)cancel:(id)sender {
+ [self dismissModalViewControllerAnimated:YES];
+}
+
+@end
View
15 SSToolkit/SSPersonAddressTableViewCell.h
@@ -0,0 +1,15 @@
+//
+// SSPersonAddressTableViewCell.h
+// SSToolkit
+//
+// Created by Sam Soffes on 9/12/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+@interface SSPersonAddressTableViewCell : UITableViewCell {
+
+}
+
++ (CGFloat)heightForDetailText:(NSString *)detailText tableWidth:(CGFloat)tableWidth;
+
+@end
View
33 SSToolkit/SSPersonAddressTableViewCell.m
@@ -0,0 +1,33 @@
+//
+// SSPersonAddressTableViewCell.m
+// SSToolkit
+//
+// Created by Sam Soffes on 9/12/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+#import "SSPersonAddressTableViewCell.h"
+
+@implementation SSPersonAddressTableViewCell
+
+#pragma mark Class Methods
+
++ (CGFloat)heightForDetailText:(NSString *)detailText tableWidth:(CGFloat)tableWidth {
+ static UILineBreakMode lineBreakMode = UILineBreakModeWordWrap;
+ UIFont *font = [UIFont boldSystemFontOfSize:15.0];
+
+ CGFloat height = [detailText sizeWithFont:font constrainedToSize:CGSizeMake(tableWidth - 113.0, 1000.0) lineBreakMode:lineBreakMode].height + 23.0;
+ return fmax(44.0, height);
+}
+
+#pragma mark UITableViewCell
+
+- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
+ if ((self = [super initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:reuseIdentifier])) {
+ self.detailTextLabel.numberOfLines = 0;
+ self.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
+ }
+ return self;
+}
+
+@end
View
18 SSToolkit/SSPersonFooterView.h
@@ -0,0 +1,18 @@
+//
+// SSPersonFooterView.h
+// SSToolkit
+//
+// Created by Sam Soffes on 9/16/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+@interface SSPersonFooterView : UIView {
+
+ UIButton *_editButton;
+ UIButton *_deleteButton;
+}
+
+@property (nonatomic, retain, readonly) UIButton *editButton;
+@property (nonatomic, retain, readonly) UIButton *deleteButton;
+
+@end
View
45 SSToolkit/SSPersonFooterView.m
@@ -0,0 +1,45 @@
+//
+// SSPersonFooterView.m
+// SSToolkit
+//
+// Created by Sam Soffes on 9/16/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+#import "SSPersonFooterView.h"
+
+@implementation SSPersonFooterView
+
+@synthesize editButton = _editButton;
+@synthesize deleteButton = _deleteButton;
+
+- (id)initWithFrame:(CGRect)frame {
+ if ((self = [super initWithFrame:frame])) {
+ self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+
+ UIColor *titleColor = [UIColor colorWithRed:0.318 green:0.400 blue:0.569 alpha:1.0];
+
+ _editButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
+ [_editButton setTitleColor:titleColor forState:UIControlStateNormal];
+ [_editButton setTitle:@"Edit Contact" forState:UIControlStateNormal];
+ _editButton.titleLabel.font = [UIFont boldSystemFontOfSize:12.0];
+ [self addSubview:_editButton];
+
+ _deleteButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
+ [_deleteButton setTitleColor:titleColor forState:UIControlStateNormal];
+ [_deleteButton setTitle:@"Delete Contact" forState:UIControlStateNormal];
+ _deleteButton.titleLabel.font = [UIFont boldSystemFontOfSize:12.0];
+ [self addSubview:_deleteButton];
+ }
+ return self;
+}
+
+
+- (void)layoutSubviews {
+ CGSize buttonSize = CGSizeMake(ceil(self.frame.size.width / 2.0) - 15.0, 44.0);
+
+ _editButton.frame = CGRectMake(10.0, 10.0, buttonSize.width, buttonSize.height);
+ _deleteButton.frame = CGRectMake(10.0 + buttonSize.width + 10, 10.0, buttonSize.width, buttonSize.height);
+}
+
+@end
View
26 SSToolkit/SSPersonHeaderView.h
@@ -0,0 +1,26 @@
+//
+// SSPersonHeaderView.h
+// SSToolkit
+//
+// Created by Sam Soffes on 9/8/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+@interface SSPersonHeaderView : UIView {
+
+ BOOL _alignImageToLeft;
+ BOOL _organization;
+ UIImageView *_imageView;
+ NSString *_personName;
+ NSString *_organizationName;
+}
+
+@property (nonatomic, assign, getter=isOrganization) BOOL organization;
+@property (nonatomic, assign) BOOL alignImageToLeft;
+@property (nonatomic, retain, readonly) UIImageView *imageView;
+
+@property (nonatomic, retain) UIImage *image;
+@property (nonatomic, copy) NSString *personName;
+@property (nonatomic, copy) NSString *organizationName;
+
+@end
View
151 SSToolkit/SSPersonHeaderView.m
@@ -0,0 +1,151 @@
+//
+// SSPersonHeaderView.m
+// SSToolkit
+//
+// Created by Sam Soffes on 9/8/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+#import "SSPersonHeaderView.h"
+#import "SSDrawingMacros.h"
+#import "UIImage+SSToolkitAdditions.h"
+#import <QuartzCore/QuartzCore.h>
+
+static CGFloat kSSPersonHeaderViewImageSize = 64.0;
+
+@interface SSPersonHeaderView (PrivateMethods)
+- (void)_updateImage;
+@end
+
+@implementation SSPersonHeaderView
+
+@synthesize organization = _organization;
+@synthesize alignImageToLeft = _alignImageToLeft;
+@synthesize imageView = _imageView;
+@synthesize personName = _personName;
+@synthesize organizationName = _organizationName;
+
+#pragma mark NSObject
+
+- (void)dealloc {
+ [_imageView removeFromSuperview];
+ [_imageView release];
+
+ self.personName = nil;
+ self.organizationName = nil;
+ [super dealloc];
+}
+
+
+#pragma mark UIView
+
+- (id)initWithFrame:(CGRect)frame {
+ if ((self = [super initWithFrame:frame])) {
+ self.backgroundColor = [UIColor groupTableViewBackgroundColor];
+ self.opaque = YES;
+
+ _organization = NO;
+ _alignImageToLeft = YES;
+
+ _imageView = [[UIImageView alloc] initWithFrame:CGRectZero];
+ _imageView.clipsToBounds = YES;
+ _imageView.layer.cornerRadius = 3.0;
+ [self addSubview:_imageView];
+ [self _updateImage];
+ }
+ return self;
+}
+
+
+- (void)layoutSubviews {
+ _imageView.frame = CGRectMake(_alignImageToLeft ? 10.0 : 19.0, 15.0, kSSPersonHeaderViewImageSize, kSSPersonHeaderViewImageSize);
+}
+
+
+- (void)drawRect:(CGRect)rect {
+ CGFloat textX = _alignImageToLeft ? 87.0 : 96.0;
+
+ CGFloat width = self.frame.size.width - 105.0;
+ CGSize constraintSize = CGSizeMake(width, 200.0);
+ UILineBreakMode lineBreakMode = UILineBreakModeWordWrap;
+ UIColor *textColor = [UIColor blackColor];
+ UIColor *shadowTextColor = [UIColor whiteColor];
+ UIFont *personNameFont = [UIFont boldSystemFontOfSize:18.0];
+ UIFont *organizationNameFont = [UIFont systemFontOfSize:14.0];
+
+ // Calculate sizes
+ CGSize personNameSize = [_personName sizeWithFont:personNameFont constrainedToSize:constraintSize lineBreakMode:lineBreakMode];
+ CGSize organizationNameSize = _organizationName ? [_organizationName sizeWithFont:organizationNameFont constrainedToSize:constraintSize lineBreakMode:lineBreakMode] : CGSizeZero;
+
+ // Draw person name
+ CGFloat personNameY = 15.0;
+ if (_organizationName) {
+ personNameY += roundf((kSSPersonHeaderViewImageSize - personNameSize.height - organizationNameSize.height) / 2.0);
+ } else {
+ personNameY += roundf((kSSPersonHeaderViewImageSize - personNameSize.height) / 2.0);
+ }
+ CGRect personNameRect = CGRectMake(textX, personNameY, personNameSize.width, personNameSize.height);
+
+ [shadowTextColor set];
+ [_personName drawInRect:CGRectAddPoint(personNameRect, CGPointMake(0.0, 1.0)) withFont:personNameFont lineBreakMode:lineBreakMode];
+
+ [textColor set];
+ [_personName drawInRect:personNameRect withFont:personNameFont lineBreakMode:lineBreakMode];
+
+ // Draw organization name
+ if (_organizationName) {
+ CGFloat organizationNameY = personNameRect.origin.y + personNameRect.size.height;
+ CGRect organizationNameRect = CGRectMake(textX, organizationNameY, organizationNameSize.width, organizationNameSize.height);
+
+ [shadowTextColor set];
+ [_organizationName drawInRect:CGRectAddPoint(organizationNameRect, CGPointMake(0.0, 1.0)) withFont:organizationNameFont lineBreakMode:lineBreakMode];
+
+
+ [textColor set];
+ [_organizationName drawInRect:organizationNameRect withFont:organizationNameFont lineBreakMode:lineBreakMode];
+ }
+}
+
+
+#pragma mark Private Methods
+
+- (void)_updateImage {
+ if (_imageView.image) {
+ _imageView.layer.borderColor = [UIColor colorWithWhite:0.0 alpha:0.5].CGColor;
+ _imageView.layer.borderWidth = 1.0;
+ return;
+ }
+
+ _imageView.image = [UIImage imageNamed:(_organization ? @"images/ABPictureOrganization.png" : @"images/ABPicturePerson.png") bundle:@"SSToolkit.bundle"];
+ _imageView.layer.borderColor = nil;
+ _imageView.layer.borderWidth = 0.0;
+}
+
+
+#pragma mark Setters
+
+- (void)setOrganization:(BOOL)org {
+ if (_organization == org) {
+ return;
+ }
+
+ _organization = org;
+
+ [self _updateImage];
+ [self setNeedsDisplay];
+}
+
+
+- (void)setImage:(UIImage *)image {
+ self.imageView.image = image;
+ [self _updateImage];
+}
+
+
+#pragma mark Getters
+
+- (UIImage *)image {
+ return self.imageView.image;
+}
+
+@end
View
37 SSToolkit/SSPersonViewController.h
@@ -0,0 +1,37 @@
+//
+// SSPersonViewController.h
+// SSToolkit
+//
+// Created by Sam Soffes on 9/8/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+#import <AddressBook/AddressBook.h>
+
+@class SSPersonHeaderView;
+@class SSPersonFooterView;
+
+extern NSInteger kSSPersonViewControllerDeleteActionSheetTag;
+
+@interface SSPersonViewController : UITableViewController <UIActionSheetDelegate> {
+
+ ABRecordRef _displayedPerson;
+ ABAddressBookRef _addressBook;
+
+ SSPersonHeaderView *_headerView;
+ SSPersonFooterView *_footerView;
+ NSInteger _numberOfSections;
+ NSMutableArray *_rowCounts;
+ NSMutableDictionary *_cellData;
+}
+
+@property (nonatomic, assign) ABRecordRef displayedPerson;
+@property (nonatomic, assign) ABAddressBookRef addressBook;
+
+- (id)initWithPerson:(ABRecordRef)aPerson;
+- (id)initWithPerson:(ABRecordRef)aPerson addressBook:(ABAddressBookRef)anAddressBook;
+
+- (void)editPerson:(id)sender;
+- (void)deletePerson:(id)sender;
+
+@end
View
452 SSToolkit/SSPersonViewController.m
@@ -0,0 +1,452 @@
+//
+// SSPersonViewController.m
+// SSToolkit
+//
+// Created by Sam Soffes on 9/8/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+#import "SSPersonViewController.h"
+#import "SSPersonHeaderView.h"
+#import "SSPersonFooterView.h"
+#import "SSPersonAddressTableViewCell.h"
+#import "SSEditPersonViewController.h"
+#import "NSString+SSToolkitAdditions.h"
+#import <AddressBookUI/AddressBookUI.h>
+
+NSInteger kSSPersonViewControllerDeleteActionSheetTag = 987;
+
+@interface SSPersonViewController (PrivateMethods)
++ (NSString *)_formatLabel:(NSString *)rawLabel;
+@end
+
+@implementation SSPersonViewController
+
+@synthesize addressBook = _addressBook;
+@synthesize displayedPerson = _displayedPerson;
+
+#pragma mark Class Methods
+
++ (NSString *)_formatLabel:(NSString *)rawLabel {
+ NSString *label = nil;
+
+ // Strip weird wrapper
+ if ([rawLabel length] > 9 && [[rawLabel substringWithRange:NSMakeRange(0, 4)] isEqual:@"_$!<"]) {
+ label = [rawLabel substringWithRange:NSMakeRange(4, [rawLabel length] - 8)];
+ } else {
+ label = [[rawLabel copy] autorelease];
+ }
+
+ // Lowercase unless iPhone
+ if ([label isEqual:(NSString *)kABPersonPhoneIPhoneLabel] == NO) {
+ label = [label lowercaseString];
+ }
+
+ return label;
+}
+
+
+#pragma mark NSObject
+
+- (id)init {
+ if ((self = [super initWithStyle:UITableViewStyleGrouped])) {
+ _headerView = [[SSPersonHeaderView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 84.0)];
+ _numberOfSections = 1;
+ _rowCounts = [[NSMutableArray alloc] init];
+ _cellData = [[NSMutableDictionary alloc] init];
+ }
+ return self;
+}
+
+
+- (void)dealloc {
+ if (_addressBook) {
+ CFRelease(_addressBook);
+ _addressBook = nil;
+ }
+
+ if (_displayedPerson) {
+ CFRelease(_displayedPerson);
+ _displayedPerson = nil;
+ }
+
+ [_headerView release];
+ [_footerView release];
+ [_rowCounts release];
+ [_cellData release];
+ [super dealloc];
+}
+
+
+#pragma mark Initializers
+
+- (id)initWithPerson:(ABRecordRef)aPerson {
+ self = [self initWithPerson:aPerson addressBook:nil];
+ return self;
+}
+
+
+- (id)initWithPerson:(ABRecordRef)aPerson addressBook:(ABAddressBookRef)anAddressBook {
+ if (self = [self init]) {
+ if (aPerson) {
+ self.displayedPerson = aPerson;
+
+ if (anAddressBook) {
+ self.addressBook = anAddressBook;
+ }
+ }
+ }
+ return self;
+}
+
+
+#pragma mark UIViewController
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+
+ self.title = @"Info";
+ self.tableView.tableHeaderView = _headerView;
+
+ _footerView = [[SSPersonFooterView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width, 74.0)];
+ self.tableView.tableFooterView = _footerView;
+
+ [_footerView.editButton addTarget:self action:@selector(editPerson:) forControlEvents:UIControlEventTouchUpInside];
+ [_footerView.deleteButton addTarget:self action:@selector(deletePerson:) forControlEvents:UIControlEventTouchUpInside];
+}
+
+
+#pragma mark Actions
+
+- (void)editPerson:(id)sender {
+ SSEditPersonViewController *viewController = [[SSEditPersonViewController alloc] init];
+ viewController.displayedPerson = self.displayedPerson;
+ UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
+ [viewController release];
+ [self.navigationController presentModalViewController:navigationController animated:YES];
+ [navigationController release];
+}
+
+
+- (void)deletePerson:(id)sender {
+ UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete Contact" otherButtonTitles:nil];
+ actionSheet.tag = kSSPersonViewControllerDeleteActionSheetTag;
+ [actionSheet showInView:self.view];
+ [actionSheet release];
+}
+
+
+#pragma mark Getters
+
+- (ABAddressBookRef)addressBook {
+ if (_addressBook) {
+ return _addressBook;
+ }
+
+ // Create one if none exists
+ _addressBook = ABAddressBookCreate();
+ return _addressBook;
+}
+
+
+#pragma mark Setters
+
+- (void)setAddressBook:(ABAddressBookRef)book {
+ if (_addressBook) {
+ CFRelease(_addressBook);
+ _addressBook = nil;
+ }
+
+ if (!book) {
+ return;
+ }
+
+ _addressBook = CFRetain(book);
+}
+
+
+- (void)setDisplayedPerson:(ABRecordRef)person {
+ if (_displayedPerson) {
+ CFRelease(_displayedPerson);
+ _displayedPerson = nil;
+ }
+
+ if (!person) {
+ return;
+ }
+ _displayedPerson = CFRetain(person);
+
+ // Image
+ if (ABPersonHasImageData(_displayedPerson)) {
+ NSData *imageData = (NSData *)ABPersonCopyImageData(_displayedPerson);
+ UIImage *image = [UIImage imageWithData:imageData];
+ _headerView.image = image;
+ [imageData release];
+ } else {
+ _headerView.image = nil;
+ }
+
+ // Name
+ ABPropertyID nameProperties[] = {
+ kABPersonPrefixProperty,
+ kABPersonFirstNameProperty,
+ kABPersonMiddleNameProperty,
+ kABPersonLastNameProperty,
+ kABPersonSuffixProperty
+ };
+
+ NSMutableArray *namePieces = [[NSMutableArray alloc] init];
+ NSInteger namePiecesTotal = sizeof(nameProperties) / sizeof(ABPropertyID);
+ for (NSInteger i = 0; i < namePiecesTotal; i++) {
+ NSString *piece = (NSString *)ABRecordCopyValue(_displayedPerson, nameProperties[i]);
+ if (piece) {
+ [namePieces addObject:piece];
+ [piece release];
+ }
+ }
+
+ _headerView.personName = [namePieces componentsJoinedByString:@" "];
+ [namePieces release];
+
+ // Organization
+ NSString *organizationName = (NSString *)ABRecordCopyValue(_displayedPerson, kABPersonOrganizationProperty);
+ _headerView.organizationName = organizationName;
+ [organizationName release];
+
+ // Multivalues
+ _numberOfSections = 0;
+ [_rowCounts removeAllObjects];
+ ABPropertyID multiProperties[] = {
+ kABPersonPhoneProperty,
+ kABPersonEmailProperty,
+ kABPersonURLProperty,
+ kABPersonAddressProperty
+ };
+
+ NSInteger multiPropertiesTotal = sizeof(multiProperties) / sizeof(ABPropertyID);
+ for (NSInteger i = 0; i < multiPropertiesTotal; i++) {
+ // Get values count
+ ABPropertyID property = multiProperties[i];
+ ABMultiValueRef valuesRef = ABRecordCopyValue(_displayedPerson, property);
+ NSInteger valuesCount = 0;
+ if (valuesRef != nil) valuesCount = ABMultiValueGetCount(valuesRef);
+
+ if (valuesCount > 0) {
+ _numberOfSections++;
+ [_rowCounts addObject:[NSNumber numberWithInteger:valuesCount]];
+ } else {
+ //CFRelease(valuesRef);
+ continue;
+ }
+
+ // Loop through values
+ for (NSInteger k = 0; k < valuesCount; k++) {
+ NSIndexPath *indexPath = [NSIndexPath indexPathForRow:k inSection:_numberOfSections - 1];
+
+ // Get label
+ NSString *rawLabel = (NSString *)ABMultiValueCopyLabelAtIndex(valuesRef, k);
+ NSString *label = [[self class] _formatLabel:rawLabel];
+ [rawLabel release];
+
+ // Get value
+ NSString *value = (NSString *)ABMultiValueCopyValueAtIndex(valuesRef, k);
+
+ // Merge address dictionary
+ if (i == 3 && [value isKindOfClass:[NSDictionary class]]) {
+ NSDictionary *addressDictionary = (NSDictionary *)value;
+
+ NSMutableString *addressString = [[NSMutableString alloc] init];
+
+ NSString *street = [addressDictionary objectForKey:(NSString *)kABPersonAddressStreetKey];
+ NSString *city = [addressDictionary objectForKey:(NSString *)kABPersonAddressCityKey];
+ NSString *state = [addressDictionary objectForKey:(NSString *)kABPersonAddressStateKey];
+ NSString *zip = [addressDictionary objectForKey:(NSString *)kABPersonAddressZIPKey];
+ NSString *country = [addressDictionary objectForKey:(NSString *)kABPersonAddressCountryKey];
+
+ // Street
+ if (street) {
+ [addressString appendString:street];
+ }
+
+ // City
+ if (city) {
+ if ([addressString length] > 0) {
+ [addressString appendString:@"\n"];
+ }
+ [addressString appendString:city];
+ }
+
+ // State
+ if (state) {
+ if ([addressString length] > 0) {
+ [addressString appendString:(city ? @" " : @"\n")];
+ }
+ [addressString appendString:state];
+ }
+
+ // Zip
+ if (zip) {
+ if ([addressString length] > 0) {
+ [addressString appendString:(state || city ? @" " : @"\n")];
+ }
+ [addressString appendString:zip];
+ }
+
+ // Country
+ if (country) {
+ if ([addressString length] > 0) {
+ [addressString appendString:@"\n"];
+ }
+ [addressString appendString:country];
+ }
+
+ [value release];
+ value = addressString;
+ }
+
+ // Get url
+ NSString *urlString = nil;
+ switch (i) {
+ // Phone number
+ case 0: {
+ NSString *cleanedValue = [value stringByReplacingOccurrencesOfString:@" " withString:@""];
+ cleanedValue = [cleanedValue stringByReplacingOccurrencesOfString:@"-" withString:@""];
+ cleanedValue = [cleanedValue stringByReplacingOccurrencesOfString:@"(" withString:@""];
+ cleanedValue = [cleanedValue stringByReplacingOccurrencesOfString:@")" withString:@""];
+ urlString = [NSString stringWithFormat:@"tel://%@", value];
+ break;
+ }
+
+ // Email
+ case 1: {
+ urlString = [NSString stringWithFormat:@"mailto:%@", value];
+ break;
+ }
+
+ // URL
+ case 2: {
+ urlString = value;
+ break;
+ }
+
+ // Address
+ case 3: {
+ urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", [value URLEncodedString]];
+ break;
+ }
+ }
+
+ // Add dictionary to cell data
+ NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:
+ label, @"label",
+ value, @"value",
+ [NSURL URLWithString:urlString], @"url",
+ [NSNumber numberWithInteger:property], @"property",
+ nil];
+ [value release];
+ [_cellData setObject:dictionary forKey:indexPath];
+ [dictionary release];
+ }
+
+ CFRelease(valuesRef);
+ }
+
+ // Note
+ NSString *note = (NSString *)ABRecordCopyValue(_displayedPerson, kABPersonNoteProperty);
+ if (note) {
+ _numberOfSections++;
+ [_rowCounts addObject:[NSNumber numberWithInteger:1]];
+
+ NSDictionary *noteDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:
+ @"notes", @"label",
+ note, @"value",
+ [NSNumber numberWithInteger:kABPersonNoteProperty], @"property",
+ nil];
+ [_cellData setObject:noteDictionary forKey:[NSIndexPath indexPathForRow:0 inSection:_numberOfSections - 1]];
+ [noteDictionary release];
+ }
+ [note release];
+
+ // Reload table
+ if (_numberOfSections < 1) {
+ _numberOfSections = 1;
+ }
+ [self.tableView reloadData];
+}
+
+
+#pragma mark UITableViewDataSource
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+ return _numberOfSections;
+}
+
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ if ([_rowCounts count] == 0) {
+ return 0;
+ }
+ return [[_rowCounts objectAtIndex:section] integerValue];
+}
+
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ static NSString *valueCellIdentifier = @"valueCellIdentifier";
+ static NSString *addressValueCellIdentifier = @"addressValueCellIdentifier";
+
+ NSDictionary *cellDictionary = [_cellData objectForKey:indexPath];
+ UITableViewCell *cell = nil;
+
+ if ([[cellDictionary objectForKey:@"property"] integerValue] == kABPersonAddressProperty) {
+ cell = [tableView dequeueReusableCellWithIdentifier:addressValueCellIdentifier];
+ if (!cell) {
+ cell = [[[SSPersonAddressTableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:addressValueCellIdentifier] autorelease];
+ }
+ } else {
+ cell = [tableView dequeueReusableCellWithIdentifier:valueCellIdentifier];
+ if (!cell) {
+ cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:valueCellIdentifier] autorelease];
+ }
+ }
+
+ cell.textLabel.text = [cellDictionary objectForKey:@"label"];
+ cell.detailTextLabel.text = [cellDictionary objectForKey:@"value"];
+ cell.selectionStyle = [[UIApplication sharedApplication] canOpenURL:[cellDictionary objectForKey:@"url"]] ? UITableViewCellSelectionStyleBlue : UITableViewCellSelectionStyleNone;
+
+ return cell;
+}
+
+
+#pragma mark UITableViewDelegate
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+ NSDictionary *cellDictionary = [_cellData objectForKey:indexPath];
+ if ([[cellDictionary objectForKey:@"property"] integerValue] == kABPersonAddressProperty) {
+ return [SSPersonAddressTableViewCell heightForDetailText:[cellDictionary objectForKey:@"value"] tableWidth:self.tableView.frame.size.width];
+ }
+ return 44.0;
+}
+
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+ [tableView deselectRowAtIndexPath:indexPath animated:YES];
+
+ NSDictionary *cellDictionary = [_cellData objectForKey:indexPath];
+ [[UIApplication sharedApplication] openURL:[cellDictionary objectForKey:@"url"]];
+}
+
+
+#pragma mark UIActionSheetDelegate
+
+- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
+ if (actionSheet.tag != kSSPersonViewControllerDeleteActionSheetTag) {
+ return;
+ }
+
+ // Delete person
+ ABAddressBookRemoveRecord(self.addressBook, self.displayedPerson, nil);
+ ABAddressBookSave(self.addressBook, nil);
+ [self.navigationController popViewControllerAnimated:YES];
+}
+
+@end
View
1 SSToolkit/SSToolkit.h
@@ -26,6 +26,7 @@
#import <SSToolkit/SSCollectionViewController.h>
#import <SSToolkit/SSMessagesViewController.h>
#import <SSToolkit/SSModalViewController.h>
+#import <SSToolkit/SSPersonViewController.h>
#import <SSToolkit/SSPickerViewController.h>
#import <SSToolkit/SSViewController.h>

No commit comments for this range

Something went wrong with that request. Please try again.