首页 > 解决方案 > 如何仅更改 UIDatePicker 中所选日期的文本颜色

问题描述

我一直在寻找解决方案,但没有发现任何对我有用的东西。

这是我的问题。我有一个 UIDatePicker,我只想更改所选日期文本的颜色。我用了这段代码

[self.datePicker setValue:COLOR_ORANGE forKeyPath:@"textColor"];
SEL selector = NSSelectorFromString( @"setHighlightsToday:" );
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature :
                               [UIDatePicker
                                instanceMethodSignatureForSelector:selector]];

但它为日期选择器中的所有文本着色附上截图,这不是我想要的。这个问题有解决方案吗?谢谢

标签: objective-cxcodedatepickeruidatepicker

解决方案


推荐阅读