Latest 1.0.1
Homepage https://github.com/numa08/NNPickerController
License MIT
Platforms ios 6.0, requires ARC
Frameworks UIKit
Authors

Build Status

NNPickerController is library for UI. Application user can picke one of element by this UI.

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Implementation

On your UIViewController, you write that code,


NSArray *elementsArray ... // Tha element will be picked by PickerController
// Allocate and Initialize

NNPickerController *picker = [[NNPickerController alloc] init];

// Picker's cancel button was clicked handler;
picker.cancelHandler = ^(NNPickerController *picker) {
    [picker dismissPickerController];
};

// Element was picked handler
picker.finishPickingHandler = ^(NNPickerController *picker, UITableView *tableView,NSIndexPath *indexPath){
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    self.elementLabel.text = elementsArray[indexPath.row];
    [picker dismissPickerController];
};

// Configuration for Picker Controller
[picker setNumberOfSection:^NSInteger{
    return 1;
} withNumberOfRow:^NSInteger(NSInteger section) {
    return elementsArray.count;
} withCellForRowAtIndexPath:^UITableViewCell *(UITableView *tableView, NSIndexPath *indexPath) {
    NSString *cellIdentifier = [NSString stringWithFormat:@"cell%@/%@", @(indexPath.row),@(indexPath.section)];
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell != nil) {
        return cell;
    }
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    cell.textLabel.text = elementsArray[indexPath.row];
    if (indexPath.row == 0) {
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
    }
    return cell;
}];

// show picker controller
[picker showPickerControllerForViewController];

Installation

NNPickerController is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "NNPickerController"

Author

numa08, [email protected]

License

NNPickerController is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "NNPickerController",
    "version": "1.0.1",
    "summary": "NNPickerController is UI for picking one element.",
    "description": "                       NNPickerController is UI libary. This interface can select one element, like UIPickerController + UIActionSheet.nn                       When ios8, Developer cannot create custom UIActionSheet layout. Now, there can it.n",
    "homepage": "https://github.com/numa08/NNPickerController",
    "license": "MIT",
    "authors": {
        "numa08": "[email protected]"
    },
    "source": {
        "git": "https://github.com/numa08/NNPickerController.git",
        "tag": "1.0.1"
    },
    "social_media_url": "https://twitter.com/numa08",
    "platforms": {
        "ios": "6.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes",
    "resource_bundles": {
        "NNPickerController": [
            "Pod/Assets/*.storyboard"
        ]
    },
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This