开发者

UIPickerView - Selects row too fast

开发者 https://www.devze.com 2022-12-15 18:18 出处:网络
I am currently using a UIPIckerView in my app to allow a user to select from a list of options.The problem is that there isn\'t enough of a delay when the user stops spinning the wheel and it is selec

I am currently using a UIPIckerView in my app to allow a user to select from a list of options. The problem is that there isn't enough of a delay when the user stops spinning the wheel and it is selecting a value before the user has a chance to scroll further down the list.

Is there a way to override the default behavior that selects the row as soon as the wheel stops spinning and the user removes their finger? I see Mobile Safari includes a "Done" button which would be great.

I can provide code if n开发者_如何转开发ecessary (not sure how it would help).

Thanks!


You can add this manually; just add a done button to the view that holds the UIPicker, and have IT do whatever action you're currently performing in – pickerView:didSelectRow:inComponent:.


The UIPickerView automatically selects which ever row stops in the center. It does not work like a table but more like a popup menu. As such, you can't use a picker view like a button to call an action because it will trigger the moment the user stops moving it whether that represents their final choice or not.

Instead, as noted previously, you need a second control element (usually a button) to call the action that makes use of the pickerview's selection.

0

精彩评论

暂无评论...
验证码 换一张
取 消