Latest 1.1.0
Homepage https://github.com/zigdanis/PickerCells
License MIT
Platforms ios 6.0, requires ARC
Authors

This class adds UIDatePicker or UIPickerView that will expand or collapse by tapping on the cell in your UITableView.

Inspired by Apple’s DateCell example and andjash’s DateCellsController.

Screenshots

PickerCells
PickerCells

Minimum iOS version

iOS 6.0

Usage

  1. Import with #import "PickerCells.h"
  2. Instantiate and setup PickerCellsController class.

    self.pickersController = [[PickerCellsController alloc] init];
    [self.pickersController attachToTableView:self.tableView tableViewsPriorDelegate:self withDelegate:self];
  3. Add UIPickerView and UIDatePicker instances with correspoding indexPaths

    UIPickerView *pickerView = [[UIPickerView alloc] init];
    pickerView.delegate = self;
    pickerView.dataSource = self;
    NSIndexPath *pickerIP = [NSIndexPath indexPathForRow:1 inSection:1];
    [self.pickersController addPickerView:pickerView forIndexPath:pickerIP];
    
    UIDatePicker *datePicker1 = [[UIDatePicker alloc] init];
    datePicker1.datePickerMode = UIDatePickerModeDate;
    datePicker1.date = [NSDate date];
    NSIndexPath *path1 = [NSIndexPath indexPathForRow:2 inSection:0];
    [self.pickersController addDatePicker:datePicker1 forIndexPath:path1];
  4. Check it out! Try pressing cells on specified indexPath’s to see how pickers will expand underneath them.
  5. This class do not responsible for giving you information about picker selected values. You should do it by yourself. But you can get pickers from PickerCellsController object by using corresponding cells indexPaths:

    id picker = [self.pickersController pickerForOwnerCellIndexPath:indexPath];
    if ([picker isKindOfClass:UIDatePicker.class]) {
    UIDatePicker *datePicker = (UIDatePicker *)picker;
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"dd-MM-yyyy"];
    cell.textLabel.text = [dateFormatter stringFromDate:[datePicker date]];
    }

Installation

pod 'PickerCells'

License

MIT

Latest podspec

{
    "name": "PickerCells",
    "version": "1.1.0",
    "summary": "UIDatePicker or UIPickerView that will slide in/out by tapping on the cell in your UITableView",
    "description": "This class adds UIDatePicker or UIPickerView that will slide in/out by tapping on the cell in your UITableView.nInspired by Apple's DateCell example and andjash's DateCellsController.",
    "homepage": "https://github.com/zigdanis/PickerCells",
    "screenshots": [
        "http://i.imgur.com/Z8vbhNFl.png",
        "http://i.imgur.com/WfgTUtel.png"
    ],
    "license": "MIT",
    "authors": {
        "Danis Ziganshin": "[email protected]"
    },
    "source": {
        "git": "https://github.com/zigdanis/PickerCells.git",
        "tag": "1.1.0"
    },
    "platforms": {
        "ios": "6.0"
    },
    "requires_arc": true,
    "source_files": "PickerCells"
}

Pin It on Pinterest

Share This