NSStepper class

Discussion in 'Mac Programming' started by rethish, Nov 3, 2008.

  1. rethish macrumors member

    Joined:
    Oct 16, 2008
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
  3. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #3
    Well steppers first need a minimum and maximum value and a starting value:
    Code:
    [stepper setMinValue:0.0];
    [stepper setMaxValue:100.0];
    [steper setDoubleValue:50.0];
    To know when the stepper value has changed, give it a target and action. This is usually done in Interface Builder. Then in the action method you can access the stepper's value like any other control (since it inherits from NSControl):
    Code:
    - (IBAction)stepperAction:(id)sender {
        [textField setDoubleValue:[stepper doubleValue]];
    }
     

Share This Page