Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2011
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.00 KB | None | 0 0
  1. //
  2. //  SecondViewController.m
  3. //  Smsflatrate
  4. //
  5. //  Created by Artjom Zabelin on 3/29/11.
  6. //  Copyright 2011 ArtworkAD. All rights reserved.
  7. //
  8.  
  9. #import "SecondViewController.h"
  10. #import "Three20/Three20.h"
  11. #import "AddressBookDataSource.h"
  12. #import "AddressBookUI/AddressBookUI.h"
  13.  
  14. @implementation SecondViewController
  15.  
  16. @synthesize txtnumber;
  17.  
  18. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  19. {
  20.     self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  21.     if (self) {
  22.         self.dataSource = [[AddressBookDataSource new] autorelease];
  23.         _fields = [[NSArray alloc] initWithObjects:
  24.                    [[[TTMessageRecipientField alloc] initWithTitle: TTLocalizedString(@"To:", @"")
  25.                                                           required: YES] autorelease], nil];
  26.         self.showsRecipientPicker = YES;
  27.     }
  28.     return self;
  29. }
  30.  
  31. -(void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker{
  32.     [self dismissModalViewControllerAnimated:YES];
  33. }
  34.  
  35. -(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person{
  36.          [self addRecipient:@"test" forFieldAtIndex:0];
  37.     [self dismissModalViewControllerAnimated:YES];
  38.     return NO;
  39. }
  40.  
  41. -(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier{
  42.     return NO;
  43. }
  44.  
  45. -(void)messageWillShowRecipientPicker{
  46.     ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
  47.     picker.peoplePickerDelegate = self;
  48.     // Display only a person's phone, email, and birthdate
  49.     NSArray *displayedItems = [NSArray arrayWithObject:[NSNumber numberWithInt:kABPersonPhoneProperty]];
  50.    
  51.    
  52.     picker.displayedProperties = displayedItems;
  53.     // Show the picker
  54.     [self presentModalViewController:picker animated:YES];
  55.     [picker release];
  56. }
  57.  
  58. - (void)dealloc
  59. {
  60.     [super dealloc];
  61. }
  62.  
  63. - (void)didReceiveMemoryWarning
  64. {
  65.     // Releases the view if it doesn't have a superview.
  66.     [super didReceiveMemoryWarning];
  67.    
  68.     // Release any cached data, images, etc that aren't in use.
  69. }
  70.  
  71. #pragma mark - View lifecycle
  72.  
  73. /*
  74. // Implement loadView to create a view hierarchy programmatically, without using a nib.
  75. - (void)loadView
  76. {
  77. }
  78. */
  79.  
  80. /*
  81. // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
  82. - (void)viewDidLoad
  83. {
  84.     [super viewDidLoad];
  85. }
  86. */
  87.  
  88. - (void)viewDidUnload
  89. {
  90.     [super viewDidUnload];
  91.     // Release any retained subviews of the main view.
  92.     // e.g. self.myOutlet = nil;
  93. }
  94.  
  95. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  96. {
  97.     // Return YES for supported orientations
  98.     return (interfaceOrientation == UIInterfaceOrientationPortrait);
  99. }
  100.  
  101. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement