Home > DeveloperSection > Forums > How to set background image into UIPickerView in iOS?
Alex Leblois
Alex Leblois

Total Post:67

Posted on    January-27-2016 5:19 AM

 iPhone iPhone  Ios  Objective C 

 2 Reply(s)
 761  View(s)
Rate this:
I have created an iPhone application. In our application I used UIPickerView controller, I want to know that is it possible to change the background of UIPickerView!
Please guide me how to do it Or can we make UIPickerView skin transparent?

Tarun Kumar

Total Post:210

Posted on    January-27-2016 5:21 AM

Yes, of course we can change the background of UIPickerView Controller.
First of all create a UIView which will be used as background of UIPickerView and after we will add this view as subview of picker view, like this:

UIView *backgroundViewForPickerView = [[UIView alloc]
[backgroundViewForPickerView setBackgroundColor: [UIColor colorWithPatternImage:
                                  [UIImage imageNamed:@"BackgroundView.png"]]];
[[[pickerView subViews] objectAtIndex:2] addSubview: backgroundViewForPickerView];

I hope it will be helpful for you. thank you.

Modified On Jan-27-2016 05:24:36 AM

Somal Jaspreet
Somal Jaspreet

Total Post:1

Posted on    October-16-2016 2:49 PM

hey guys
i want to add images to picker view , and i am real new to coding

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

Follow MindStick