by Simon 'Simme' Kern (@simme) - www.simme.org
A subclass of UIPickerView that can be used for float input.
Usage
Add the and header SKFloatPickerView.h and implementation SKFlotPickerView.m files to your project.
Add the SKFloatPickerViewDelegate Protocol to your ViewController or wherever you want to handle the user-input.
Init SKFloatPickerView with the following command:
- (id)initWithInts:(int)aNumberOfIntegers andDecimals:(int)aNumberOfDecimals andNegativeNumbers:(BOOL)negativeNumbersAllowed
set the pickerViews property pickerViewDelegate to wherever you implemented the SKFloatPickerViewDelegate protocol.
Add SKFloatPickerView to your view as a subview or present it in UIActionSheet.
How to use? - example
SKFloatPickerView *pickerView = [[SKFloatPickerView alloc]initWithInts:2 andDecimals:2 andNegativeNumbers:YES]; pickerView.pickerViewDelegate = self; [self.view.addsubview:pickerView];
Delegate method example
- (void)pickerViewChangedValueTo:(float)newFloat
{
self.floatLabel.text = [NSString stringWithFormat:@"%2.2f",newFloat];
}
License
See LICENSE file. TL;DR: BSD License