SpaceDog SpaceDog - 2 years ago 111
Objective-C Question

UIPickerView: select one element after the other finishes animation

I have a

with two elements: months and days. I am doing this

[self.picker selectRow:3 inComponent:0 animated:YES];
[self.picker selectRow:10 inComponent:1 animated:YES];

This makes both elements to roll to the selected items.

But In fact what I want to do is to roll the first element and then, when the first element finishes rolling, roll the second element.

I can do a dispatch after delay but this is a hack.

Is there any way to know when the first animation ends and then trigger the second?

Answer Source

Implement the delegate method pickerView:didSelectRow:inComponent:.

Call selectRow on the fist picker, then when didSelectRow is called with row 3 for the first picker, call selectRow on the second picker.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download