views:

303

answers:

1

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 framworks imported. I don't get any errors, it's just the view loads with nothing in it.

What am I missing?

A: 

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