更改日期戳的文字颜色 [英] Changing text color of datepicker

查看:155
本文介绍了更改日期戳的文字颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在iOS8中更改datepicker的文字颜色?我在iOS7和以前不可能,在第8版中发生了什么变化?



例如,我在Yahoo Weather中找到修改的选择器!



解决方案

找到stackoverflow的评论的解决方案。如果您只需要
将文本颜色更改为您的,并为您的选择器分配此子类。对于whiteColor作为魔术。



只有减去我发现颜色两行选定的数字仍然是灰色。



$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ b b b b b b b b b b b b b b b b b b b b b b b b b b b changed = true
self.setValue(UIColor.whiteColor(),forKey:textColor)
}
super.addSubview(view)
}
}


Is it any way to change text color of datepicker in iOS8? I've that it isn't possible in iOS7 and prior, something changed in 8th version?

For example I've found modified picker in Yahoo Weather!

解决方案

Found solution at comments of stackoverflow. If you need just to change text color to yours and assign this subclass you your picker. For whiteColor works as magic.

Only minus i've found that color two lines of selected number is still gray.

class ColoredDatePicker: UIDatePicker {
    var changed = false
    override func addSubview(view: UIView) {
        if !changed {
            changed = true
            self.setValue(UIColor.whiteColor(), forKey: "textColor")
        }
        super.addSubview(view)
    }
}

这篇关于更改日期戳的文字颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆