Is there anyway to change the background color of the DatePicker
view? I have the following Picker:
DatePicker(selection: $form.start, in: Date()..., displayedComponents: .date) {}
.padding(.vertical, 6)
.labelsHidden()
.accentColor(.black)
But the picker has that grayish tint around the date (See image below). I just want the entire background to be white. I tried .background(Color.white)
but that doesn't do anything. How can I make the entire background white?
I discovered that you can do this by initialising it as follows:
init() {
UIDatePicker.appearance().backgroundColor = UIColor.init(.white) // changes bg color
UIDatePicker.appearance().tintColor = UIColor.init(.white) // changes font color
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With