How can I change the style of pickerview. I want to change its white background to green color and its black frame to red color. Anyone please help. I am a beginner.
+1
A:
As far as I know you can't actually change the frame's color, but you can create an image with a transparent area in the middle and add that on top of the frame like so:
[picker addSubview:image];
As for the background color, you can create your own custom views for each row by implementing the UIPickerViewDelegate
method:
- (UIView *)pickerView:(UIPickerView *)pickerView
viewForRow:(NSInteger)row
forComponent:(NSInteger)component
reusingView:(UIView *)aView;
You could then set the background color of the view you return via
[myView setBackgroundColor:[UIColor yellowColor]];
However this only affects the rows with data. I don't think you can currently set the background color of the component itself which is a shame.
Paulo Fierro
2010-04-23 09:44:13