Ad
UISlider IOS App Custom Values In Swift
let step: Float = 10000.0
let roundedValue = round(sender.value / step) * step
sender.value = roundedValue
ProgressLabel.text = "\(sender.value) sqft"
I have a single slider that needs to give 2 values when moved once the values are to be given through hard code.
I am not able to produce the desired result.
it should be exactly like we have in our design. Single Slider. When I slide each step will show the values as mentioned in the list.
Ad
Answer
If I understand the question correctly, you want the label to show custom values, like $5,000 - $10,000 sq.ft. $10,000 - $25,000 sq.ft. $25,000 - $50,000 sq.ft. $50,000 - $100,000 sq.ft. $100,000+ sq.ft
If this is the case, why son't you use a simple switch statement or an if -else if - else block and add the logic there ?
Something like:
if (sender.value) < 0.05 {
progressLabel.text = "too low"
} else if (sender.value) < 0.2 {
progressLabel.text = "$5,000 - $10,000 sq.ft."
} else if (sender.value) < 0.8 {
progressLabel.text = " $10,000 - $25,000 sq.ft.."
} else
progressLabel.text = "$100,000+ sq.ft"
}
Ad
source: stackoverflow.com
Related Questions
- → Function Undefined in Axios promise
- → What are the pluses/minuses of different ways to configure GPIOs on the Beaglebone Black?
- → Click to navigate on mobile devices
- → Playing Video - Server is not correctly configured - 12939
- → How to allow api access to android or ios app only(laravel)?
- → Axios array map callback
- → Access the Camera and CameraRoll on Android using React Native?
- → Update React [Native] View on Day Change
- → Shopify iOS SDK - issue converting BuyProductVariant to BuyProduct
- → BigCommerce and shopify API
- → Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- → React Native - Differences between Android and IOS
- → What is the difference between React Native and React?
Ad