如何在iOS中将UIPickerView文本颜色更改为白色

如何在iOS中将UIPickerView文本颜色更改为白色,第1张

概述我想知道是否有人知道如何将UIPickerView文本颜色更改为白色.我的代码如下: 码: (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{ [self.pickerView setValue:[UIColor whiteColor] forKey 我想知道是否有人知道如何将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文本颜色更改为白色所遇到的程序开发问题。

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

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1005669.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存