UIPickerView,检测“滚轮"开始和停止? [英] UIPickerView, detect "rolling wheel" start and stop?

查看:333
本文介绍了UIPickerView,检测“滚轮"开始和停止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现,如果执行以下操作:

  1. 单击将UIPickerView动画化到我的视图中的按钮
  2. 快速启动滚轮,然后滚过最后一个项目
  3. 使用按钮关闭视图

然后它还没有选择最后一个项目.

我尝试通过在每次触发didSelectRow方法时将其简单地输出到控制台,并在滚轮稳定在最后一项上时触发该方法来进行尝试.

我是否可以检测到车轮仍在滚动,以便可以延迟检查选定的值直到其稳定下来?

如果有问题,我正在使用MonoTouch进行编程,但是如果您有一个代码示例,那么我可以很好地阅读Objective-C代码以重新实现它.

解决方案

我认为您可以检查UIPickerView是否处于动画制作中并等待其停止.在链接

I just discovered that if I do the following:

  1. Click the button that animates a UIPickerView into my view
  2. Quickly start the wheel rolling towards, then past, the last item
  3. Dismiss the view with a button

Then it has not yet selected the last item yet.

I tried this by simply outputting to the console whenever the didSelectRow method was fired, and it fires when the wheel stabilizes on the last item.

Can I detect that the wheel is still rolling, so that I can delay checking it for a selected value until it stabilizes?

If it matters, I'm programming in MonoTouch, but I can read Objective-C code well enough to reimplement it, if you have a code example that is.

解决方案

I think you can just check if the UIPickerView is in the middle of animating and wait for it to stop. This was answered here link

这篇关于UIPickerView,检测“滚轮"开始和停止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆