关于在UISlider中显示连续滑块值 [英] about showing continuous slider value in UISlider

查看:113
本文介绍了关于在UISlider中显示连续滑块值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我想用UI Slider做的事情....

Here's what I want to do with UI Slider ....

我有一堆有时间的文件,我根据滑块值显示它们。问题是我想在用户更改/移动滑块时显示滑块值。换句话说,当用户移动滑块时(而不是之后),该值应该更改(并显示在屏幕上)。

I have a bunch of files with times and I show them based on slider value. The problem is I want to show the slider value when the user is changing/moving the slider. In other words, the value should change (and be shown on the screen) as the user is moving the slider (and not afterwards).

任何人都可以给我任何想法怎么做?

Can anyone please give me any idea how to do it ?

谢谢。

推荐答案

您可以要求获取一个名为当滑块的值改变时。然后使用该更改,您应该更新标签的文本。

You can ask to get a method called when the slider's value changes. Then using that change, you should update the text of a label.

收听价值变化:

[mySlider addTarget:self action:@selector(mySliderChanged:) forControlEvents:UIControlEventValueChanged];

然后更新标签:

NSString *labelString = [NSString stringWithFormat:@"Slider value is %d", mySlider.value];
[myLabel setText:labelString];

这篇关于关于在UISlider中显示连续滑块值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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