alexbayker
alexbayker

Reputation: 1095

Change font color in new DatePicker (iOS14)

How can i change foreground color in new DatePicker for iOS 14?

VStack (alignment: .center, spacing: 0)
{
    DatePicker(selection: self.$enddate, in: self.endMinDate()...self.endMaxDate()) {
        Text("Start")
    }.labelsHidden().colorMultiply(MyColor.bluecolor)
}.foregroundColor(MyColor.bluecolor)

enter image description here

Old DatePicker in iOS 13 without problem:

enter image description here

Upvotes: 4

Views: 2532

Answers (1)

Asperi
Asperi

Reputation: 257711

I don't have your colors but the following should work.

Tested with Xcode 12.1 / iOS 14.1

demo

VStack (alignment: .center, spacing: 0)
{
    DatePicker(selection: self.$enddate, in: self.endMinDate()...self.endMaxDate()) {
        Text("Start")
    }.labelsHidden()
}
.accentColor(MyColor.bluecolor)  // << this one !!
//.accentColor(.red)             // << used for demo

Upvotes: 3

Related Questions