zoukankan      html  css  js  c++  java
  • IOS中修改自定义PickerView的字体颜色

    通过重写这个方法来写实现的:

    - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{  
        UILabel* pickerLabel = (UILabel*)view;  
        if (!pickerLabel){  
            pickerLabel = [[UILabel alloc] init];  
            // Setup label properties - frame, font, colors etc  
            //adjustsFontSizeToFitWidth property to YES  
            pickerLabel.minimumFontSize = 8.;  
            pickerLabel.adjustsFontSizeToFitWidth = YES;  
            [pickerLabel setTextAlignment:UITextAlignmentLeft];  
            [pickerLabel setBackgroundColor:[UIColor clearColor]];  
            [pickerLabel setFont:[UIFont boldSystemFontOfSize:15]];  
        }  
        // Fill the label text here  
        pickerLabel.text=[self pickerView:pickerView titleForRow:row forComponent:component];  
        return pickerLabel;  
    }

    可以修改文字的颜色和背景都可以实现这个方法,希望可以帮到你!!!!!

  • 相关阅读:
    zookeeper实现主从选举
    基于Zookeeper+MHA的mysql高可用架构设计
    MHA实现MySQL主从自动在线切换功能
    redis 主从复制
    虚拟iP
    nginx 主从
    代码的快速操作
    网页延时加载
    ajax循环数据
    js实现网页中打印、刷新、关闭、前进、后退、返回等操作
  • 原文地址:https://www.cnblogs.com/zhufeng1994/p/4744055.html
Copyright © 2011-2022 走看看