In IB you can configure min and max for a NSStepper, but... what about if I don't want to limit the user with a max value. Can I do it? How?
Asked
Active
Viewed 199 times
3
-
1Set the Maximum value to a really big number. – rmaddy Jun 05 '15 at 21:11
1 Answers
0
There is no thing in computers "without max". Each property has it's own data type. In case of NSStepper
it's double. Double can have it's maximum value depending on the number of bits used to store (this is platform dependent) Read here. Double typically uses 8 bytes (64bits to store). So double has it's own maximum because it is limited to 64bits. It's maximum value is DBL_MAX
. Exact explanation of exact number is an advanced topic of floating point data representation on computer.
Enough theory. Assign in code to maxValue DBL_MAX. In case compiler protests add float.h header
#include float.h
NSStepper *myStepper;
myStepper.maxValue = DBL_MAX;
NSStepper:
@interface NSStepper : NSControl <NSAccessibilityStepper> {
@private
unsigned int _reserved1;
unsigned int _reserved2;
unsigned int _reserved3;
unsigned int _reserved4;
}
@property double minValue;
@property double maxValue;
@property double increment;
@property BOOL valueWraps;
@property BOOL autorepeat;
@end

Marek H
- 5,173
- 3
- 31
- 42