How to set a default Value of a UIPickerView

前端 未结 7 1203
刺人心
刺人心 2020-12-13 05:42

I have a problem with my UIPickerView. I have 3 values in it EU AP and NA. When I start the app EU seems to be selected but when I make a NSLog(@\"%@\", [regions objec

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-13 06:27

    I too had this problem. But apparently there is an issue of the order of method calls. You must call:

    [self.picker selectRow:2 inComponent:0 animated:YES];
    

    after calling

    [self.view addSubview:self.picker];
    

提交回复
热议问题