HOW TO SET BACKGROUND COLOR OF UIPICKERVIEW IN IOS?

Eric Martell

Total Post:9

Points:63
Posted by  Eric Martell
 2631  View(s)
Ratings:
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.!
  1. Tarun Kumar

    Post:214

    Points:1642
    Re: How to set background color of uipickerview in iOS?

    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];

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!