I've been looking for quite some time for a solution but couldn't find the right answer for me.

I'm trying to set two sliders - one for minimum price and one for maximum price, and then create labels that will contain the prices. Both sliders will change the labels' values accordingly. I've yet to find a good way to display a price and alter it with the sliders, could you please help me?

Thank you and I'm truly sorry if this is a stupid question, I have just started iOS a few weeks ago. Thanks a bunch!

有帮助吗?

解决方案 2

you can set the maximumValue property of UISlider, if you set maximumValue is 1000,then the ranges of slider`s value is 0~1000.

is this your problem?

其他提示

If you would Google for basic examples first, you would find these resources:

So what you have to do is follow the steps below:

  1. Create both UISlider's and UILabel's on Storyboard/Interface Builder.
  2. Connect them with code in your View Controller as IBOutlet's.
  3. Add Target actions to UISlider's - UIControlEventValueChanged.
  4. Update UILabel's text when that target action is fired.

While this seems much, it is practically a very basic iOS development technique. View the links above for more detailed explanation.

And remember, always do your own research first, before presenting a problem to StackOverflow. This question is very basic and every programmer should be able to solve it, without asking others to solve it for you.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top