gonzobrains
gonzobrains

Reputation: 8036

iOS - how to adjust the scale of a slider

I have an app where I want to place an object within a photo and scale it to reflect the distance it should be from the camera. At full size I want it to reflect approximately 10 meters away from the camera and at its smallest size I want it to be about 30 meters away.

Unfortunately, the slider seems to scale it almost infinitely, without looking very realistic in scaling. What's the best way to accomplish this such that I get both minimum and maximum distances as well as making intermediate distances scale in a realistic fashion (i.e., each intermediate step reflecting the actual distance it should be from the camera)?

Upvotes: 0

Views: 761

Answers (1)

Costique
Costique

Reputation: 23722

By default UISlider's minimumValue and maximumValue are 0 and 1, respectively, which might explain the scaling behavior you're seeing. You can configure these values to simplify your calculations or, alternatively, scale the default 0-1 range to 10-30 meters.

Upvotes: 1

Related Questions