I have a tableViewCell in a TableView that gets big if you click on it and if you click it again it goes back to its original size.
What I'd like it to do is, display a datePicker when its big but every time I try to simply add a datePicker in my code it is at the bottom of the tableView and not inside the big cell.
This is my code for adding the datePicker when the cell gets big.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 0) {
return 150.0;
}
else if ([self cellIsSelected:indexPath] && indexPath.row == 1 ){
[_dateLabel removeFromSuperview]; //just the label of the cell
// Add the picker
UIDatePicker *pickerView = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, 350, 200)];
pickerView.datePickerMode = UIDatePickerModeDate;
[_cell addSubview:pickerView];
return kCellHeight * 4.0;
}
else if (![self cellIsSelected:indexPath]) {
[_myPicker removeFromSuperview];
}
return kCellHeight;
}
How do I add a UIDatePicker to a TableViewCell?