Latest 0.0.4
Homepage https://github.com/zhukov-ever/ZHNInputViewPicker
License MIT
Platforms ios 7.0, requires ARC
Frameworks Foundation
Authors

Wrapper for UIPickerView which allow use it as input view

Podfile

platform :ios, '7.0'
pod "ZHNInputViewPicker"

Usage

@property (nonatomic, strong) ZHNInputViewPicker* dataPicker;

self.dataPicker = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([ZHNInputViewPicker class]) owner:self options:nil] firstObject];
self.dataPicker.delegate = self;
self.dataPicker.dataSource = self;
[self.dataPicker reloadData];

#pragma mark - UITextFieldDelegate

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    textField.inputView = self.dataPicker;
    self.dataPicker.sender = textField;
    return YES;
}

#pragma mark - ZHNInputViewPickerDelegate, ZHNInputViewPickerDataSource

- (void)didCompleteInputViewPicker:(ZHNInputViewPicker *)inputView
{
    [self.view endEditing:YES];
}

- (void) inputViewPicker:(ZHNInputViewPicker*)inputView
            didSelectRow:(NSInteger)rowIndex
              withColumn:(NSInteger)columnIndex
               withTitle:(NSString*)title
{
    NSArray* _arr = [inputView selectedRowTitles];
    if ([inputView.sender isKindOfClass:[UITextField class]])
        ((UITextField*)inputView.sender).text = [_arr componentsJoinedByString:@", "];
}

- (NSInteger) numberOfColumnsForInputViewPicker:(ZHNInputViewPicker*)inputView
{
    return 3;
}

- (NSInteger) inputViewPicker:(ZHNInputViewPicker*)inputView
         numberOfRowsInColumn:(NSInteger)columnNumber
{
    return 5;
}

- (NSString*) inputViewPicker:(ZHNInputViewPicker*)inputView
                  titleForRow:(NSInteger)rowIndex
                    forColumn:(NSInteger)columnIndex
{
    return [NSString stringWithFormat:@"r%@ c%@", @(rowIndex), @(columnIndex)];
}

Latest podspec

{
    "name": "ZHNInputViewPicker",
    "version": "0.0.4",
    "summary": "Wrapper for UIPickerView which allow use it as input view.",
    "homepage": "https://github.com/zhukov-ever/ZHNInputViewPicker",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Zhn": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/zhukov-ever/ZHNInputViewPicker.git",
        "tag": "0.0.4"
    },
    "source_files": [
        "Classes",
        "Classes/**/*.{h,m}"
    ],
    "public_header_files": "Classes/**/*.h",
    "resources": "Classes/**/*.xib",
    "frameworks": "Foundation",
    "requires_arc": true
}

Pin It on Pinterest

Share This