views:

27

answers:

2

Hello everyone, i was just wondering if there was a way to change the fontSize of a row in a uipickerview for a specific component and not for all of them. Also the different components still have to be able to display different things and not the same. Does anyone have a solution for this problem? Thanks in advance!

+1  A: 
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view 
{
        UILabel *lbl = (UILabel *)view;
        // Reuse the label if possible...
       if ((lbl == nil) || ([lbl class] != [UILabel class])) {
            CGRect frame = CGRectMake(0.0, 0.0, 270, 32.0);
           lbl = [[[UILabel alloc] initWithFrame:frame] autorelease];

                .... do what you like ...

        }   
        lbl.textColor = [UIColor blackColor];
           lbl.text = [self.<yourdata> objectAtIndex:row];
        return lbl; 
}
Aaron Saunders
Alright, but now if i set the text property of the label for example, the same text appears in every component...
Christoph v
you need to get the data based on the row that is provided in the delegate method
Aaron Saunders
yea but then i only get different data for each row but its still the same data in a different component... don't i?
Christoph v
A: 

The calling parameters tell you which view, row and component you are setting. Check them and set the appropriate thing only if both the row and component match (compare and use flow control) what you want for that row and component.

hotpaw2