iOS   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了如何在iOS中将UIPickerView文本颜色更改为白色大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想知道是否有人知道如何将uIPickerView文本颜色更改为白色.我的代码如下:

码:

(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{

    [self.pickerView SETVALue:[UIColor whiteColor] forKey:@"textColor"];

}

任何的想法?

解决方法

使用此代码

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
    UILabel *tView = (UILabel*)view;
    if (!tView)
    {
        tView = [[UILabel alloc] init];
        [tView setTextColor:[UIColor whiteColor]];
        [tView setFont:[UIFont fontWithName:@"font-name-here" size:15]];
        [tView setTextAlignment:NSTextAlignmentCenter];
    }
    // Fill the label text here
    return tView;
}

大佬总结

以上是大佬教程为你收集整理的如何在iOS中将UIPickerView文本颜色更改为白色全部内容,希望文章能够帮你解决如何在iOS中将UIPickerView文本颜色更改为白色所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。