2014-10-01 56 views
1

我會問奇怪的問題。切換2個UIPickerview的組件彼此

我有1個UIPickerView 2個組件。我將它用於翻譯用戶界面,以便用戶可以通過UIPickerView選擇源語言和目標語言。

我會問你的;當用戶點擊開關按鈕時,源和目標語言UILabel's按照預期相互切換。爲了保持UX的邏輯,我還需要更改UIPickerView的組件。

這是從PickerView傳遞的值的切換標籤的第一個步驟:

Switching Language source and target labels

Switching Language source and target labels

第二步期待PickerView部件改變彼此太。

Component's need to switch each other

我怎麼能成功呢?任何幫助將不勝感激。

Regards,

Önder。

回答

1

[picker selectRow:0 inComponent:0 animated:YES];

+0

謝謝你的回答,它的工作原理。 – 2014-10-01 08:47:40

1

使用UIPickerView方法

SWIFT

func selectRow(_ row: Int, 
    inComponent component: Int, 
     animated animated: Bool) 

目的-C

- (void)selectRow:(NSInteger)row 
     inComponent:(NSInteger)component 
     animated:(BOOL)animated 

這應該動畫pickerView每個COM在你需要動畫的行上。