MD. MD. - 1 month ago 31
iOS Question

how to change the background color in UIPickerView?

I want to change the background color in

UIPickerView
, Is it possible?

Answer

UPDATE: One simple trick is to set the alpha on some of the subviews. Which one specifically depends on how many components you have, but the code is:

[(UIView*)[[picker subviews] objectAtIndex:2] setAlpha:0.5f];

This will make the dial semi transparent and show through the background colour.


Setting the backgroudColor doesn't appear to do anything. The best I have been able to do so far is set the background colour of individual component rows, which is next to useless as the base colour of the component will remain white.

Ideally I'd like to set the background colour of an each component (i.e. dial).