• 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;
    }
  • 相关阅读:
    3、Semantic-UI之定义容器
    2、Semantic-UI之网格布局
    1、Semantic-UI之开发环境搭建
    PyCharm创建普通项目配置支持jinja2语法
    CentOS 7安装GitLab、汉化、配置邮件发送
    Docker swarm 实战-部署wordpress
    线程和进程
    NGINX内置变量
    iTerm2 + Oh My Zsh 打造舒适终端体验
    CentOS 7修改网卡名称
  • 原文地址:https://www.cnblogs.com/weipeng168/p/6269666.html
Copyright © 2020-2023  润新知