Skip to content

UISlider: maximumValueImageRectForBounds() method ​

The maximumValueImageRectForBounds() method returns where the right-end image (maximumValueImage) is drawn when the slider occupies the given bounds.

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

Syntax ​

maximumValueImageRectForBounds(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: maximumValueImageRectForBounds needs an object with all of: x, y, width, height.
  • A field is missing or not a finite number: maximumValueImageRectForBounds 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.maximumValueImageRectForBounds({ 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 maximumValueImageRectForBounds:].

See also ​