0

I have what I thought would be a simple task.

I have a sample project that will let a user click a button to pull up the AddressBook user interface within a view. From what I see most of the work is done here:

-(IBAction) checkOutBookid)sender
{
ABPeoplePickerNavigationController *peoplePicker=[[ABPeoplePickerNavigationController alloc] init];

[peoplePicker setPeoplePickerDelegate:self];

[self.navigationController presentModalViewControllereoplePicker animated:YES];
[peoplePicker release];
}

And there is a button on a view has TouchUp Inside linked to this action. Now, instead of clicking a button, I want a view to just have the AddressBook already loaded. I tried putting the code above (everything between the {} ) in the ViewController's didLoad event. Nope, that didn't work. I have the AB frameworks imported. I don't get any errors, it's just the view loads with nothing in it.

What am I missing?

Jason Plank
  • 2,336
  • 5
  • 31
  • 40

1 Answers1

1

This seems to work:

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    ABPeoplePickerNavigationController *peoplePicker=[[ABPeoplePickerNavigationController alloc] init];

    [peoplePicker setPeoplePickerDelegate:self];

    [self presentModalViewController:peoplePicker animated:YES];
    [peoplePicker release];
}
gerry3
  • 21,420
  • 9
  • 66
  • 74