Search code examples
objective-ccocoa-touchuitableviewuipickerview

Pick month from a list in UITableViewCell?


What's the best way for me to allow the user to pick a month from a UITableViewCell? UIPickerView requires the height to be very large which makes it look ugly..What are some other options? I don't want to put a text field there and manually make the user enter a month.. Thanks.


Solution

  • UIDatePicker *datePicker = [[UIDatePicker alloc] init];
    datePicker.datePickerMode = UIDatePickerModeDate;
    [datePicker addTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged];
    datePicker.tag = indexPath.row;
    textField.delegate= self;
    
    textField.inputView = datePicker; // Now the Keyboard will not appear //
    
    [datePicker release];