Change UIDatePicker font color?

后端 未结 15 1819
南方客
南方客 2020-12-04 19:12

All I want to do is change the font color of the UIDatePicker. I\'ve researched other questions but they\'re all involving changing other properties and customizing the enti

15条回答
  •  死守一世寂寞
    2020-12-04 20:13

    Next solution comes from "arturgrigor" and it works great in my apps, just copy it, paste it in viewDidLoad method, and enjoy it :

    [my_datePicker setValue:[UIColor whiteColor] forKeyPath:@"textColor"];
    SEL selector = NSSelectorFromString( @"setHighlightsToday:" );
    NSInvocation *invocation = [NSInvocation invocationWithMethodSignature :
                               [UIDatePicker 
                                instanceMethodSignatureForSelector:selector]];
    BOOL no = NO;
    [invocation setSelector:selector];
    [invocation setArgument:&no atIndex:2];
    [invocation invokeWithTarget:my_datePicker];
    

提交回复
热议问题