zoukankan      html  css  js  c++  java
  • iOS UIPickerView 可能会出现选中行不显示或者去掉上下两条横线的问题解决,

             

                 这个问题很容易解决,需要在pickerview的代理方法中设置上下横线的颜色就可以了

                                                                                                                                                                                                                                            

    - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
    {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(0, 0, _picker.frame.size.width, 32);
        label.font = [UIFont systemFontOfSize:22];
        if (component == 0) {
            label.text = self.yearArray[row];
        }else if (component == 1) {
            label.text = self.monthArray[row];
        }else if (component == 2) {
            label.text = self.dayArray[row];
        }
        label.textAlignment = NSTextAlignmentCenter;
        
        //  设置横线的颜色,实现显示或者隐藏
        ((UILabel *)[_picker.subviews objectAtIndex:1]).backgroundColor = FINELINECOLOR;
        
        ((UILabel *)[_picker.subviews objectAtIndex:2]).backgroundColor = FINELINECOLOR;
        
        return label;
    }
  • 相关阅读:
    关于页面的已终止操作
    Assembly Manifest 通俗简易手册
    C# Enumeration 使用
    打架必备!擒敌拳116动连贯动作 分解动作
    解决js中onMouseOut事件冒泡的问题
    DOM标准与IE的html元素事件模型区别
    vim编辑器
    linux常用的命令解释
    搭建本地仓库
    Linux系统虚拟机安装
  • 原文地址:https://www.cnblogs.com/weipeng168/p/6269666.html
Copyright © 2011-2022 走看看