Rick Song
Rick Song

Reputation: 1

AddressBook loaded in a Tab's View

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?

Upvotes: 0

Views: 679

Answers (1)

gerry3
gerry3

Reputation: 21460

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];
}

Upvotes: 1

Related Questions