以编程方式停止iphone上的uipickerview动画 [英] programmatically stop uipickerview animation on iphone

查看:191
本文介绍了以编程方式停止iphone上的uipickerview动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含选择器和UIToolbar的UIActionSheet。在UIToolBar上有一个保存按钮。但是,我的一些用户报告在UIPickerView停止旋转之前按下保存按钮,因此只检索初始值(旋转前)。

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).

有没有办法获取当前UIPickerView的选定项目,一旦用户点击保存或获得活动所选项目的旋转时获得反馈?

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?

谢谢

推荐答案

即使它们仍然在旋转时它们会解除选择器,但是一旦它停止,即使它不可见,选择器仍然会调用具有最终选定行的代理。假设您尚未解除分配,可以设置委托接收方以检查选择器是否可见,如果不可见,则保存所选值。

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.

这篇关于以编程方式停止iphone上的uipickerview动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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