Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // SecondViewController.m
- // Smsflatrate
- //
- // Created by Artjom Zabelin on 3/29/11.
- // Copyright 2011 ArtworkAD. All rights reserved.
- //
- #import "SecondViewController.h"
- #import "Three20/Three20.h"
- #import "AddressBookDataSource.h"
- #import "AddressBookUI/AddressBookUI.h"
- @implementation SecondViewController
- @synthesize txtnumber;
- - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- {
- self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
- if (self) {
- self.dataSource = [[AddressBookDataSource new] autorelease];
- _fields = [[NSArray alloc] initWithObjects:
- [[[TTMessageRecipientField alloc] initWithTitle: TTLocalizedString(@"To:", @"")
- required: YES] autorelease], nil];
- self.showsRecipientPicker = YES;
- }
- return self;
- }
- -(void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker{
- [self dismissModalViewControllerAnimated:YES];
- }
- -(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person{
- [self addRecipient:@"test" forFieldAtIndex:0];
- [self dismissModalViewControllerAnimated:YES];
- return NO;
- }
- -(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier{
- return NO;
- }
- -(void)messageWillShowRecipientPicker{
- ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
- picker.peoplePickerDelegate = self;
- // Display only a person's phone, email, and birthdate
- NSArray *displayedItems = [NSArray arrayWithObject:[NSNumber numberWithInt:kABPersonPhoneProperty]];
- picker.displayedProperties = displayedItems;
- // Show the picker
- [self presentModalViewController:picker animated:YES];
- [picker release];
- }
- - (void)dealloc
- {
- [super dealloc];
- }
- - (void)didReceiveMemoryWarning
- {
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
- // Release any cached data, images, etc that aren't in use.
- }
- #pragma mark - View lifecycle
- /*
- // Implement loadView to create a view hierarchy programmatically, without using a nib.
- - (void)loadView
- {
- }
- */
- /*
- // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- }
- */
- - (void)viewDidUnload
- {
- [super viewDidUnload];
- // Release any retained subviews of the main view.
- // e.g. self.myOutlet = nil;
- }
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
- {
- // Return YES for supported orientations
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement