thanks for reading!
I'm struggling to get an inline UIPickerView to appear in a UITableViewCell as defined on a storyboard prototype cell. This file implements tableview and pickerview datasource and delegate mandatory methods (not fully shown). I am happier about my data structures, but the iOS GUI stuff I find harder in Objective C.
My data array holds info for 12 cells. When cell 0 is pressed cells 1 and 2 are expanded. Similarly 4&5 expand when 3 is pressed etc. This all works fine by adjusting the height of the cells.
I can't understand why when cellForRowAtIndexPath
is given the appropriate UIPickerView-containing cells at the picker view indexrows, does it not display them.
Header snippit (matching storyboard's reuseidentifier and tag)
#define kPickerTag 100
static NSString *kPickerCellID = @"pickerCellID";
@property (nonatomic, strong) UIPickerView *pickerView;
Relevant functions:
- (void)viewDidLoad{
...
self.pickerView = (UIPickerView *)[tableTimes viewWithTag:kPickerTag];
self.pickerView.dataSource = self; //The pickerView object in storyboard needs datasource+delegate which is this file too
self.pickerView.delegate = self;
...
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
...
//the case which returns UIPickerView rows
pickerCell = [tableView dequeueReusableCellWithIdentifier:kPickerCellID];
self.pickerView = (UIPickerView *)[pickerCell viewWithTag:kPickerTag];
return pickerCell;
...
}
Any help is much appreciated!
PS I have read the following and still can't understand it: Apple's DateCell (ad infinitum!) iOS Show UIPickerView between UITableViewCells http://masteringios.com/blog/2013/10/31/ios-7-in-line-uidatepicker/3/ http://www.raywenderlich.com/forums/viewtopic.php?f=2&t=9482