I'm using a UIPickerView and an UIToolbar, and adding it to a UIView and adding this view to my main view
addTimePicker=[[UIPickerView alloc]init];
[addTimePicker setFrame: CGRectMake(0, 20, 0, 0)];
addTimePicker.showsSelectionIndicator=YES;
addTimePicker.dataSource=self;
addTimePicker.delegate=self;
picker= [[UIView alloc] initWithFrame:CGRectMake(0, screenHeight/2+35, screenWidth, screenHeight/2+35)];
picker.backgroundColor=[UIColor whiteColor];
addToolbar=[[UIToolbar alloc] initWithFrame: CGRectMake(0, 0, self.view.frame.size.width, 45)];
addToolbar.barTintColor=[UIColor whiteColor];
addToolbar.items = [NSArray arrayWithObjects:flexibleSpace,addAvailabilityButton, nil];
[picker addSubview: addTimePicker];
[picker addSubview: addToolbar];
[self.view addSubview:picker];
However, despite configuring my controller to conform to the UIPickerViewDataSource and UIPickerViewDelegate protocols, my
-(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
or
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
or
-(NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component
aren't being called at all.
I've looked around a bit, but I can't seem to find a reason why this would not be called.
Despite returning a default of 3 for everytime the numberOfRowsInComponent is called, and 5 for the numberOfComponentsInPickerView, when I log the data, it says there are 0 rows for any component I check.
I tested this code using a new project, and it works like a charm displaying all the data.
EDIT : More testing, and this is the scene;
Not even the bloody UIDatePicker works. I can't see any of the elements that the datepicker is supposed to have. I tried simply thrwing the date picker as is onto a new view, and doing it up by connecting it to my view and so on.
I'm beginning to wonder if this is a global issue, since it affects only this one project in particular.
Found out what the problem was.
I was using a empty data set handler, https://github.com/dzenbot/DZNEmptyDataSet, that tried to handle the pickers as well. Removing this handler resolved my problem.
I've learned my lesson, and I've learned it well. 3rd party libraries are a massive gamble.
Cheers.