2012-02-12 30 views
0

我有一個UIPickerView與2個組件UIPickerView與2個組件

兩個組件的默認值被選爲初始索引。

如何將第一個組件設置爲第二個索引並將第二個組件留在第四個項目上。

- 更新 -

我加

[currencyPicker selectRow:1 inComponent:0 animated:YES]; 

viewDidLoad 

,現在在我的UIPicker元素不加載

回答

2

你可以告訴它去到特定的行,如下所示:

[myPickerView selectRow:_my_row_ inComponent: _1st_component animated:YES]; 
+0

我將此代碼添加到viewDidLoad中,並且我的UIPicker中的元素不加載。 [currencyPicker selectRow:1 inComponent:0 animated:YES]; – 2012-02-12 21:57:37

+0

在顯示選取器視圖後進行selectRow調用。 – Rayfleck 2012-02-12 22:26:31