Search code examples
iosswiftuipickerview

How to remove gap between UIPickerView Components of different background colors


I am using different background colors for each component of a UIPickerView. There is a white gap between each compnent. I want to remove that.

func pickerView(_ pickerView: UIPickerView, widthForComponent component: Int) -> CGFloat {

does not seem to help.


Solution

  • you can set pickerView background color as clear color and add n numbers of views of equal width behind the picker view where n is number of component.UIPickerView with different background color component