Reputation: 1576
I am going to ask weird question.
I have a 1 UIPickerView with 2 components. I am using it for translation UI in order to users can choose source and target language via UIPickerView.
What I am gonna ask you ; when user tap on switch button, souce and target language UILabel's are switching each other as expected. In order to stay logic in UX , i need to change UIPickerView's component as well .
This is the first step of switching label's which passed value from PickerView :
Second step expecting to PickerView components changed each other too .
How can i succeed it ? Any help will be appreciated.
Regards,
Önder.
Upvotes: 1
Views: 122
Reputation: 2823
[picker selectRow:0 inComponent:0 animated:YES];
Upvotes: 1
Reputation: 936
Use the UIPickerView method
SWIFT
func selectRow(_ row: Int,
inComponent component: Int,
animated animated: Bool)
OBJECTIVE-C
- (void)selectRow:(NSInteger)row
inComponent:(NSInteger)component
animated:(BOOL)animated
This should animate pickerView for each component at the row you need animated.
Upvotes: 1