Is there a way to check if the up or down button is pressed in NSStepper Action event?
In my ViewController.h I have this:
- (IBAction)myStepperAction:(id)sender;
In my ViewController.m I have this:
- (IBAction)myStepperAction:(id)sender { }
In my event handler I have the following: (I'm using C# but I can read some Swift)
partial void myStepperAction(Foundation.NSObject sender) {
var stepper = sender as NSStepper;
//var upPressed = stepper.upButton==true ? true : false;
}
Related question:
Is there a way to add the mouse event to an Action in Interface Builder?
Update:
Why not store the previous value and then compare? Well, I'm coming from other frameworks where information like this in the event:
event.previousValue; // store previous value
event.gestureDelta; // if -1 left swipe if 1 the right swipe
event.currentTarget == stepper.upButton // target or current target is the control in a composite component and there is a property reference to the up and down buttons