ABPeoplePickerView - How do I get it to scroll to a selected record?

622 Views Asked by At

I'm using the ABPeoplePicker in a Mac OS X application. I've hooked up a button that changes the selected record to the default 'Me' record.

This works fine, and the record gets selected, but, I need to scroll the table to see the selected record.

NSTableView has the -scrollRowToVisible:(NSInteger)rowIndex method, but I can't find anything similar for the ABPeoplePickerView

There is a notification ABPeoplePickerNameSelectionDidChangeNotification that is posted when the selected record changes, but I can't find a way of plugging in a property of the record into the view so I can make it visible.

2

There are 2 best solutions below

1
On

It will automatically scroll to your selection when using selectRecord:byExtendingSelection: for example:

[peopePickerView selectRecord:[[ABAddressBook sharedAddressBook] me] byExtendingSelection:NO];

Be sure you're passing NO for the byExtendingSelection argument.

PS: Previous poster is in iPhone land ;)

2
On

How about the scrollPersonToView method?