1

How to change the text color inside picker with various colors. For Example: enter image description here

2 Answers2

3

Use pickerView:viewForRow, and return a UILabel that has the color you want

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
    UILabel *label = [[UILabel alloc] init];
    label.text = @"Row";
    label.textColor = [UIColor greenColor];
    return label;
}
Omar Abdelhafith
  • 21,163
  • 5
  • 52
  • 56
0

Try this:-

 - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {
        UILabel *demoLbl = (id)view;
        if (!demoLbl) {
            demoLbl= [[[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [pickerView rowSizeForComponent:component].width, [pickerView rowSizeForComponent:component].height)] autorelease];
        }

        demoLbl.text = @"Demo";
        demoLbl.textColor = [UIColor redColor];
        demoLbl.font = [UIFont systemFontOfSize:14];
        return demoLbl;
    }
Deepesh
  • 8,065
  • 3
  • 28
  • 45