by Simon 'Simme' Kern (@simme) - www.simme.org
A subclass of UIPickerView that can be used for float input.
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.
SKFloatPickerView *pickerView = [[SKFloatPickerView alloc]initWithInts:2 andDecimals:2 andNegativeNumbers:YES]; pickerView.pickerViewDelegate = self; [self.view.addsubview:pickerView];
- (void)pickerViewChangedValueTo:(float)newFloat
{
self.floatLabel.text = [NSString stringWithFormat:@"%2.2f",newFloat];
}
See LICENSE file. TL;DR: BSD License