Skip to content

UISlider: minimumValueImageRectForBounds() method ​

The minimumValueImageRectForBounds() method returns where the left-end image (minimumValueImage) is drawn when the slider occupies the given bounds.

Use it to align other views with a part of the slider.

Syntax ​

minimumValueImageRectForBounds(bounds)

Parameters ​

bounds

A rectangle: a CGRect, or an object with the four numbers x, y, width, height. Usually slider.bounds. In pt.

Return value ​

A CGRect in the slider's own coordinate system, in pt. When no image is set, the width and height are both 0 (measured).

Exceptions ​

TypeError

  • bounds is not an object: minimumValueImageRectForBounds needs an object with all of: x, y, width, height.
  • A field is missing or not a finite number: minimumValueImageRectForBounds is missing width, or it is not a finite number (with the name of the field actually missing).

Examples ​

js
const slider = new UISlider();
const rect = slider.minimumValueImageRectForBounds({ x: 0, y: 0, width: 300, height: 34 });
console.log(rect.x, rect.y, rect.width, rect.height);

Result: Prints the position and size of this part.

Corresponding iOS API ​

-[UISlider minimumValueImageRectForBounds:].

See also ​