Search code examples
iosswiftuipickerviewuipicker

Uipicker background blur


When a uipicker gets presented to a screen. The background has a Light grey blur effect in the background by default. How do I change the color of this haze?


Solution

  • Try using the below code.

    pickerView.subviews.last?.backgroundColor = .red.withAlphaComponent(0.2)
    

    UIPickerView consists of 2 subviews. One is the main container and the second one is the selection indicator. So we just simply change the background of the second i.e last subview.