检查用户是否在连续UISlider上完成滑动? [英] Check if user finished sliding on a continuous UISlider?

查看:211
本文介绍了检查用户是否在连续UISlider上完成滑动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我有几个UISlider实例来更改各种值。这些值显示在滑块旁边,并在应用程序的另一个可见部分的3d空间中显示。

In my app, I have a couple of UISlider instances to change various values. The values are displayed right next to the slider, as well as rendered in a 3d space in another visible part of the app.

3d部分包括一些相当重的计算,现在它似乎不可能更新它实时的滑块变化。这意味着我必须将滑块的连接属性设置为 NO ,因此只有当滑块已经完成更改。

The 3d part includes some rather heavy calculations, and right now it doesn't seem possible to update it live as the slider changes. That would imply that I'd have to set the slider's continuous property to NO, therefore only getting updates when the slider has finished changing.

但我想要更新值更新。有一种方法有一个滑块是连续的(所以我可以更新我的价值标签实时),并仍然发送某种类型的消息,一旦用户已经完成与它交互?我现在感觉直觉是子类UISlider和覆盖 touchesEnded:方法。这是可行的吗?

I'd prefer to have the displayed value update live, however. Is there a way to have a slider that is continuous (so I can update my value-label in real time) and still sends some kind of message once the user has finished interacting with it? My gut feeling right now is to subclass UISlider and override the touchesEnded: method. Is that feasible?

推荐答案

你可以用简单的目标/动作。

You can do this with simple target/actions.

UIControlEventValueChanged 事件设置目标和操作,然后为 UIControlEventTouchUpInside 事件设置另一个目标和操作。将 continuous 属性设置为 YES 时,值更改事件将在滑块更改值时触发,内部事件将仅在用户释放控件时触发。

Set a target and action for the UIControlEventValueChanged event, and then another target and action for the UIControlEventTouchUpInside event. With the continuous property set to YES, the value changed event will fire as the slider changes value, while the touch up inside event will only fire when the user releases the control.

这篇关于检查用户是否在连续UISlider上完成滑动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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