DatePicker 设置字体颜色

 

    [self.datePicker setValue:RGBCOLOR(204, 204, 204) forKey:@"textColor"];

 

// 默认选中的颜色 为黑色 修改方法如下

//通过NSSelectorFromString获取setHighlightsToday方法

    SEL selector= NSSelectorFromString(@"setHighlightsToday:");

    //创建NSInvocation

    NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDatePicker instanceMethodSignatureForSelector:selector]];

    BOOL no = NO;

    [invocation setSelector:selector];

    //setArgument中第一个参数的类picker,第二个参数是SEL

    [invocation setArgument:&no atIndex:2];

    //invocation执行setHighlightsToday方法

    [invocation invokeWithTarget:self.datePicker];

 

 

原文地址:https://www.cnblogs.com/shifu/p/6232201.html