Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom UIPickerView with Custom Background color

I have created a sample picker-view which will display some details. Setting the Background color using:

_pickerView.backgroundColor = [UIColor redColor]; 

doesn't seems to be working . But I wish I could create a picker view like the below image

enter image description here

What I was trying to do is , the entire PickerView background color should not be white, it should fill with the UIColor which I am giving. Is that possible?? How it can be done ??

like image 696
Perseus Avatar asked Jul 11 '12 05:07

Perseus


People also ask

What is an uipickerview?

An easy to use and customizable view component that presents a UIPickerView with a toolbar, Done button, animation, design options, selected value and previously selected value functionality. Works with iOS 6 and even better in iOS 7, because it let's you change the background color of the PickerView. Images to the left: iOS 6.

Can you change the font of a string in uipickerview?

You can change many attributes of a string. You cannot change the font in attributed text for picker views. There is one more very powerful method for displaying something on a UIPickerView. There is a method in the delegate to display a UIView. One subclass of UIView is a UILabel.

How to set customize color as rectangle UIView background?

How To Set Customize Color As Rectangle UIView Background. Create an instance of UIKit.UIColor class, pass the color RGB (red, green, blue) value and color opacity (alpha) value to the UIColor class’s initializer. You can refer UIKit.UIColor initializer document .

How do I change the background color in uicolor?

Create an instance of UIKit.UIColor class, pass the color RGB (red, green, blue) value and color opacity (alpha) value to the UIColor class’s initializer. You can refer UIKit.UIColor initializer document . Now set above customized UIColor object variable as the rectangle view’s background color.


1 Answers

Addition to Nina's answer, below are some of the good custom Picker view controls which will be good to use in terms of performance and customizable.

  1. http://www.cocoacontrols.com/platforms/ios/controls/cppickerview
  2. http://www.cocoacontrols.com/platforms/ios/controls/afpickerview
  3. http://www.cocoacontrols.com/platforms/ios/controls/v8horizontalpickerview (Horizontal PickerView)
like image 130
DShah Avatar answered Sep 29 '22 18:09

DShah