• UIDatePicker自定义背景


        selectDatePicker = [[UIDatePicker alloc]init];
        selectDatePicker.frame = CGRectMake(0, 10, 280, 216);
        selectDatePicker.tag = 8001;
        selectDatePicker.datePickerMode = UIDatePickerModeDate;
        selectDatePicker.backgroundColor = [UIColor clearColor];
        
        
        //改背景色===================================================================
        UIView *v = [[selectDatePicker subviews] objectAtIndex:0];
        
        //改变最外层的背景
        UIView *v0 = [[v subviews] objectAtIndex:0 ];
        v0.backgroundColor = [Function colorWithHexString:@"#f5f5f5"];

        //去掉最大的框
        UIView *v20 = [[v subviews] objectAtIndex:20];
        v20.alpha = 0.0;
        
        //第一列的设置--------------------------------
        UIView *v1 = [[v subviews] objectAtIndex:1 ];
        v1.alpha = 0.6;
        UIView *v2 = [[v subviews] objectAtIndex:2 ];
        v2.alpha = 0;
        UIView *v3 = [[v subviews] objectAtIndex:3 ];
        v3.alpha = 0;
        UIView *v4 = [[v subviews] objectAtIndex:4 ];
        v4.backgroundColor = [Function colorWithHexString:@"#eae1d8"];
        UIView *v5 = [[v subviews] objectAtIndex:5 ];
        v5.alpha = 0.0;
        UIView *v6 = [[v subviews] objectAtIndex:6 ];
        v6.alpha=0.6;
        
        //第二列的设置--------------------------------
        UIView *v7 = [[v subviews] objectAtIndex:7 ];
        v7.alpha = 0.6;
        UIView *v8 = [[v subviews] objectAtIndex:8 ];
        v8.alpha = 0;
        UIView *v9 = [[v subviews] objectAtIndex:9 ];
        v9.alpha = 0;
        UIView *v10 = [[v subviews] objectAtIndex:10 ];
        v10.backgroundColor = [Function colorWithHexString:@"#eae1d8"];
        UIView *v11 = [[v subviews] objectAtIndex:11 ];
        v11.alpha = 0.0;
        UIView *v12 = [[v subviews] objectAtIndex:12 ];
        v12.alpha=0.6;
        
        //第三列的设置--------------------------------
        UIView *v13 = [[v subviews] objectAtIndex:13 ];
        v13.alpha = 0.6;
        UIView *v14 = [[v subviews] objectAtIndex:14 ];
        v14.alpha = 0;
        UIView *v15 = [[v subviews] objectAtIndex:15 ];
        v15.alpha = 0;
        UIView *v16 = [[v subviews] objectAtIndex:16 ];
        v16.backgroundColor = [Function colorWithHexString:@"#eae1d8"];
        UIView *v17 = [[v subviews] objectAtIndex:17 ];
        v17.alpha = 0.0;
        UIView *v18 = [[v subviews] objectAtIndex:18 ];
        v18.alpha=0.6;
        
        UIView *v19 = [[v subviews] objectAtIndex:19 ];
        v19.alpha=0.0;
        //改背景色End===================================================================

        
        
        
        
        //设置为指定时间
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setDateFormat:@"yyyy-M-d"]; //设置日期格式
        NSString *date = @"2010-10-1";
        NSDate *now = [dateFormatter dateFromString:date];
        
        
        [selectDatePicker setDate:now animated:NO];
        [viewContent addSubview:selectDatePicker];

  • 相关阅读:
    AgularJS中Unknown provider: $routeProvider解决方案
    AngularJS依赖注入
    下面是Webstorm的一些常用快捷键:
    加载多张图片,判断加载完成状态
    JS控制图片显示的大小(图片等比例缩放)
    JS中两个重要的方法 call & apply 学习
    如何用微软雅黑显示自己网页的字体
    Dev-C++的一些使用技巧快捷键
    C C语言中 *.c和*.h文件的区别!
    HTML <!--...--> 注释 、CSS/JS //注释 和 /*.....*/ 注释
  • 原文地址:https://www.cnblogs.com/lear/p/3213988.html
Copyright © 2020-2023  润新知