在iOS10中更改UIDatePicker TextColor

欣赏它

我有一种方法可以UIDatePicker在10之前的iOS版本上更改的文本颜色,但是在iOS10上,这些解决方案似乎不再起作用。我该如何恢复更改textColorfor的功能UIDatePicker

   if #available(iOS 10.0, *) {
        //Not sure of a way to do something similar here.
   } else {
        //The following lines change the textColor of UIDatePicker to white in iOS9 and older.
        self.setValue(UIColor.white, forKey: "textColor")
        self.sendAction(Selector("setHighlightsToday:"), to: nil, for: nil) 
   }
埃希里马

似乎没有任何变化,因为即使使用如下所示的Swift 3,我也能够实现这一目标。

import UIKit

class ViewController: UIViewController
{
    override func viewDidLoad()
    {
        super.viewDidLoad()

        let temp: UIDatePicker = UIDatePicker(frame: self.view.frame)
        temp.setValue(UIColor.purple, forKey: "textColor")

        view.addSubview(temp)
    }

    override func didReceiveMemoryWarning()
    {
        super.didReceiveMemoryWarning()
    }
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

UITextField textColor在iOS10中更新,而不在iOS 11中更新

ListView TextColor更改

在ReactNative中更改<TextInput />的textColor

在选择时快速更改textColor

在Swift iOS中更改方向时更改UICollectionViewCell标签textColor

在 Xamarin 中更改 IsEnabled 上按钮的 TextColor

更改UISearchBar textColor不起作用

使用微调器更改android:textColor

AppCompat:ActionBar 更改 textColor 和样式?

TextColor更改为错误的一种

无法使用主题更改按钮的“ android:textColor”

Android:如何使用条件语句更改 TextColor

iOS13的白色问题与UIKit的textColor

Android:EditText的android:textAppearance中的textColor被忽略

如何在Swift中设置UILabel的textColor

Android:MaterialButton在样式中覆盖textColor

使用Android工具栏更改SearchView中的TextColor

Android:当父对象处于焦点状态时更改TextView textColor

TextColor和其他更改动态添加视图

Android AChartEngine-无法更改饼图中的textColor

根据int值更改textswitcher / viewswitcher的textColor吗?

突出显示UITableViewCell时更改UILabel textColor吗?

在启用或禁用TextColor之类的按钮时更改BorderColor

Javascript在画布上绘制语音气泡fillStyle仅更改textcolor

从片段更改ActionBar中一个特定MenuItem的TextColor

Android 更改单选按钮的圆圈颜色和 textColor

iOS UILabel textColor在黑暗模式下未更新

iOS UILabel.appearance()。textColor不可用

iOS 14使用textColor = [UIColor colorWithCIColor:]导致UITextField崩溃