iOS Developer Library

Developer

UIKit Framework Reference UIStepper Class Reference

Options
Deployment Target:

On This Page
Language:

UIStepper

A stepper control provides a user interface for incrementing or decrementing a value. A stepper displays two buttons, one with a minus (“–”) symbol and one with a plus (“+”) symbol.

If you set stepper behavior to “autorepeat” (which is the default), pressing and holding one of its buttons increments or decrements the stepper’s value repeatedly. The rate of change depends on how long the user continues pressing the control.

The maximum value must be greater than or equal to the minimum value. If you set a maximum or minimum value that would make break this invariant, both values are set to the new value. For example, if the minimum value is 200 and you set a maximum value of 100, then both the minimum and maximum become 200.

For information about basic view behaviors, see View Programming Guide for iOS.

For more information about appearance and behavior configuration, see Steppers.

  • The continuous vs. noncontinuous state of the stepper.

    Declaration

    Swift

    var continuous: Bool

    Objective-C

    @property(nonatomic, getter=isContinuous) BOOL continuous

    Discussion

    If YEStrue, value change events are sent immediately when the value changes during user interaction. If NOfalse, a value change event is sent when user interaction ends.

    The default value for this property is YEStrue.

    Availability

    Available in iOS 5.0 and later.

  • The automatic vs. nonautomatic repeat state of the stepper.

    Declaration

    Swift

    var autorepeat: Bool

    Objective-C

    @property(nonatomic) BOOL autorepeat

    Discussion

    If YEStrue, the user pressing and holding on the stepper repeatedly alters value.

    The default value for this property is YEStrue.

    Availability

    Available in iOS 5.0 and later.

  • The wrap vs. no-wrap state of the stepper.

    Declaration

    Swift

    var wraps: Bool

    Objective-C

    @property(nonatomic) BOOL wraps

    Discussion

    If YEStrue, incrementing beyond maximumValue sets value to minimumValue; likewise, decrementing below minimumValue sets value to maximumValue. If NOfalse, the stepper does not increment beyond maximumValue nor does it decrement below minimumValue but rather holds at those values.

    The default value for this property is NOfalse.

    Availability

    Available in iOS 5.0 and later.

  • The lowest possible numeric value for the stepper.

    Declaration

    Swift

    var minimumValue: Double

    Objective-C

    @property(nonatomic) double minimumValue

    Discussion

    Must be numerically less than maximumValue. If you attempt to set a value equal to or greater than maximumValue, the system raises an NSInvalidArgumentException exception.

    The default value for this property is 0.

    Availability

    Available in iOS 5.0 and later.

  • The highest possible numeric value for the stepper.

    Declaration

    Swift

    var maximumValue: Double

    Objective-C

    @property(nonatomic) double maximumValue

    Discussion

    Must be numerically greater than minimumValue. If you attempt to set a value equal to or lower than minimumValue, the system raises an NSInvalidArgumentException exception.

    The default value of this property is 100.

    Availability

    Available in iOS 5.0 and later.

  • The step, or increment, value for the stepper.

    Declaration

    Swift

    var stepValue: Double

    Objective-C

    @property(nonatomic) double stepValue

    Discussion

    Must be numerically greater than 0. If you attempt to set this property’s value to 0 or to a negative number, the system raises an NSInvalidArgumentException exception.

    The default value for this property is 1.

    Availability

    Available in iOS 5.0 and later.

  • The numeric value of the stepper.

    Declaration

    Swift

    var value: Double

    Objective-C

    @property(nonatomic) double value

    Discussion

    When the value changes, the stepper sends the UIControlEventValueChanged flag to its target (see addTarget:action:forControlEvents:). Refer to the description of the continuous property for information about whether value change events are sent continuously or when user interaction ends.

    The default value for this property is 0. This property is clamped at its lower extreme to minimumValue and is clamped at its upper extreme to maximumValue.

    Availability

    Available in iOS 5.0 and later.