Select row After UIPickerView is loaded

后端 未结 6 2000
广开言路
广开言路 2020-12-07 22:13

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 tab

6条回答
  •  悲&欢浪女
    2020-12-07 22:39

    Call it after you retrieve the data. I don't know where you load the data so this is just a mockup of what should work. If this doesn't make sense, let me know where you are loading data so I can piece it together in my head :)

    -(void)viewDidLoad
    {
        // load data from sql
        // self.someDataArray = DATAFROMSQL
        [picker reloadAllComponents];
        [picker selectRow:0 inComponent:0 animated:YES];
    }
    

提交回复
热议问题