Select row After UIPickerView is loaded

Posted by Steve Gibson on Stack Overflow See other posts from Stack Overflow or by Steve Gibson
Published on 2009-05-01T19:59:48Z Indexed on 2010/04/22 8:03 UTC
Read the original article Hit count: 625

Filed under:
|
|

I have an iphone database app that loads a UIPickerView with data from a table. I want to set the selected row to a particular row from the data in another table.

for example: Lets say I have a UIPickerView that is loaded with X number of names of the iPhone users friends (the number of names is variable, could be 1 or 1000 and all are entered into the DB by the user). The iPhone user has a preference set that their current best friend is TED. I want the UIPickerView to be position to TED when displayed.

Where do I call selectRow?

I tried in viewDidAppear but it was never called, in titleForRow which caused all kinds of strange behavior. viewDidLoad and viewWillAppear are out of the question because I don't know what's in the datasource to the picker yet.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uipickerview