Permalink
Browse files

Initial commit

  • Loading branch information...
soffes committed Feb 6, 2011
0 parents commit 294849585e425f15c6ceaf8b1119d44d373ae3f3
@@ -0,0 +1,10 @@
+.DS_Store
+build
+*.mode1v3
+*.pbxuser
+*.perspectivev3
+*.xcworkspace
+xcuserdata
+.sass-cache
+Documentation/temp
+Documentation/Output
@@ -0,0 +1,17 @@
+//
+// PVDemoViewController.h
+// SSCatalog
+//
+// Created by Sam Soffes on 9/8/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+#import <AddressBookUI/AddressBookUI.h>
+
+@interface PVDemoViewController : UIViewController <ABPeoplePickerNavigationControllerDelegate> {
+
+}
+
+- (void)pickPerson:(id)sender;
+
+@end
@@ -0,0 +1,69 @@
+//
+// PVDemoViewController.m
+// SSCatalog
+//
+// Created by Sam Soffes on 9/8/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+#import "PVDemoViewController.h"
+#import "SSPersonViewController.h"
+
+@implementation PVDemoViewController
+
+#pragma mark UIViewController
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ self.title = @"Person";
+ 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
@@ -0,0 +1,16 @@
+//
+// PersonAppDelegate.h
+// Person
+//
+// Created by Sam Soffes on 2/6/11.
+// Copyright 2011 Sam Soffes. All rights reserved.
+//
+
+@interface PersonAppDelegate : NSObject <UIApplicationDelegate> {
+
+ UIWindow *_window;
+}
+
+@property (nonatomic, retain) UIWindow *window;
+
+@end
@@ -0,0 +1,41 @@
+//
+// PersonAppDelegate.m
+// Person
+//
+// Created by Sam Soffes on 2/6/11.
+// Copyright 2011 Sam Soffes. All rights reserved.
+//
+
+#import "PersonAppDelegate.h"
+#import "PVDemoViewController.h"
+
+@implementation PersonAppDelegate
+
+@synthesize window = _window;
+
+#pragma mark NSObject
+
+- (void)dealloc {
+ [_window release];
+ [super dealloc];
+}
+
+
+#pragma mark UIApplicationDelegate
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ _window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ _window.backgroundColor = [UIColor redColor];
+
+ PVDemoViewController *viewController = [[PVDemoViewController alloc] init];
+ UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
+ [viewController release];
+ _window.rootViewController = navigationController;
+ [navigationController release];
+
+ [_window makeKeyAndVisible];
+
+ return YES;
+}
+
+@end
@@ -0,0 +1,14 @@
+//
+// Prefix header for all source files of the 'Person' target in the 'Person' project
+//
+
+#import <Availability.h>
+
+#ifndef __IPHONE_3_0
+#warning "This project uses features only available in iPhone SDK 3.0 and later."
+#endif
+
+#ifdef __OBJC__
+ #import <UIKit/UIKit.h>
+ #import <Foundation/Foundation.h>
+#endif
@@ -0,0 +1,14 @@
+//
+// main.m
+// Person
+//
+// Created by Sam Soffes on 2/6/11.
+// Copyright 2011 Sam Soffes. All rights reserved.
+//
+
+int main(int argc, char *argv[]) {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ int retVal = UIApplicationMain(argc, argv, nil, @"PersonAppDelegate");
+ [pool release];
+ return retVal;
+}
Oops, something went wrong.

0 comments on commit 2948495

Please sign in to comment.