Thanks for helping a newb out!! This is not making sense to me. I did find another thread in this forum with another guy who had a typo in his delegate method, but I don't have that typo and it still shows up as questionmarks. What am I missing?
First, I have a view controller that is the data source for the picker. In the view controller implementation, I have the following:
1. I have an NSArray* property "categories" - the initWithNibName method initializes these. The initialization looks something like this:
2. I have the UIPickerViewDelegate and UIPickerViewDataSource protocols adopted.
3. I have the following methods:
When I run and set a breakpoint in the pickerView:titleForRow:forComponent, it doesn't break.
First, I have a view controller that is the data source for the picker. In the view controller implementation, I have the following:
1. I have an NSArray* property "categories" - the initWithNibName method initializes these. The initialization looks something like this:
Code:
categories = [[NSArray alloc] initWithObjects:@"Indoors", @"Outdoors", nil];
2. I have the UIPickerViewDelegate and UIPickerViewDataSource protocols adopted.
3. I have the following methods:
Code:
#pragma mark -
#pragma mark UIPickerViewDataSource
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
return [categories count];
}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 1;
}
#pragma mark -
#pragma mark UIPickerViewDelegate
// Retrieve the value for the row to display
- (NSString *)pickerView:(UIPickerView *)pickerView
titleForRow:(NSInteger)row
forComponent:(NSInteger)component
{
return [categories objectAtIndex:row];
}
When I run and set a breakpoint in the pickerView:titleForRow:forComponent, it doesn't break.