views:

181

answers:

2

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.

A: 

How about the scrollPersonToView method?

geowar
Isn't that only in Cocoa-Touch?
Abizern
Yep; my bad: head in iPWN land… sry for the noise… ;-)
geowar
+1  A: 

Hi. 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 ;)

Ken Aspeslagh
That's exactly what I'm doing, but it doesn't work.
Abizern
I added that line to the CocoaPeoplePicker sample code and it works there. Sorry I can't be more helpful.
Ken Aspeslagh