Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

programmatically stop uipickerview animation on iphone

I have a UIActionSheet containing a picker and a UIToolbar. On the UIToolBar there is a save button. However, some of my users reported pressing the save button before the UIPickerView stops spinning thus only retrieving the initial value (before spinning).

Is there a way to get the currently selected item of the UIPickerView once the user taps save or get feedback of the active selected item while it's spinning?

Thanks

like image 700
zsniperx Avatar asked Jan 30 '11 02:01

zsniperx


1 Answers

Even if they dismiss the picker while it's still spinning, the picker will still call the delegate with the final selected row once it stops, even if it isn't visible. Assuming you haven't deallocated it yet, you can set the delegate receiver to check if the picker is visible, and if it isn't, save the selected value.

I do this assuming it's clear the user isn't scrolling to a random value - usually when they scroll and dismiss without waiting for it to settle, it means they scrolled to either the very top or very bottom of the list. I'd say you can safely use the result of the delegate in these two cases.

like image 149
Shaun Budhram Avatar answered Oct 05 '22 07:10

Shaun Budhram