Home > DeveloperSection > Forums > How to set background color of uipickerview in iOS?
Eric Martell
Eric Martell

Total Post:9

Points:63
Posted on    December-22-2015 12:32 AM

 iPhone iPhone  Ios  Objective C 
Ratings:


 1 Reply(s)
 1229  View(s)
Rate this:
I have created a UIPickerView and added a UIView on that picker view, now I want to change background color of uipickerview.
Can anyone give me the suggestion how to do it.!


Tarun Kumar

Total Post:210

Points:1614
Posted on    December-22-2015 10:25 PM

If you want to change the background color of picker view, create a custom frame using CGRect class and assign it on the pickerview. and after that you can set the backgroundColor.

CGRect rect = CGRectMake(0, self.view.frame.size.height, self.view.frame.size.width, 196);
pickerView = [[[UIView alloc] initWithFrame:rect] autorelease];
pickerView.backgroundColor = [UIColor greyColor];
[self.view addSubview:pickerView];
[pickerView addSubview:picker];
[self.view addSubview:picker];

Don't want to miss updates? Please click the below button!

Follow MindStick