UIPickerView自定义背景
#import <UIKit/UIKit.h>
@interface MyPicker : UIPickerView {
}
@end
--------------------------------------------------------------------------------
//
// MyPicker.m
// PickerSkinTest
//
// Created by Wang WenHui on 10-5-3.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import "MyPicker.h"
#import "Function.h"
@implementation MyPicker
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// Initialization code
}
return self;
}
- (void)drawRect:(CGRect)rect {
//改变最外层的背景
UIView *v0 = [[self subviews] objectAtIndex:0 ];
v0.backgroundColor = [Function colorWithHexString:@"#f5f5f5"];
//去掉最大的框
UIView *v8 = [[self subviews] objectAtIndex:8];
v8.alpha = 0.0;
//第一列的设置--------------------------------
UIView *v1 = [[self subviews] objectAtIndex:1 ];
v1.alpha = 0.6;
UIView *v2 = [[self subviews] objectAtIndex:2 ];
v2.alpha = 0;
UIView *v3 = [[self subviews] objectAtIndex:3 ];
v3.alpha = 0;
UIView *v4 = [[self subviews] objectAtIndex:4 ];
v4.backgroundColor = [Function colorWithHexString:@"#eae1d8"];
UIView *v5 = [[self subviews] objectAtIndex:5 ];
v5.alpha = 0.0;
UIView *v6 = [[self subviews] objectAtIndex:6 ];
v6.alpha=0.6;
[self setNeedsDisplay];
}
@end
======================================================
如果是两列的就用下面这个
- (void)drawRect:(CGRect)rect {
//改变最外层的背景
UIView *v0 = [[self subviews] objectAtIndex:0 ];
v0.backgroundColor = [Function colorWithHexString:@"#f5f5f5"];
//去掉最大的框
UIView *v14 = [[self subviews] objectAtIndex:14];
v14.alpha = 0.0;
//第一列的设置--------------------------------
UIView *v1 = [[self subviews] objectAtIndex:1 ];
v1.alpha = 0.6;
UIView *v2 = [[self subviews] objectAtIndex:2 ];
v2.alpha = 0;
UIView *v3 = [[self subviews] objectAtIndex:3 ];
v3.alpha = 0;
UIView *v4 = [[self subviews] objectAtIndex:4 ];
v4.backgroundColor = [Function colorWithHexString:@"#eae1d8"];
UIView *v5 = [[self subviews] objectAtIndex:5 ];
v5.alpha = 0.0;
UIView *v6 = [[self subviews] objectAtIndex:6 ];
v6.alpha=0.6;
//第二列的设置--------------------------------
UIView *v7 = [[self subviews] objectAtIndex:7 ];
v7.alpha = 0.6;
UIView *v8 = [[self subviews] objectAtIndex:8 ];
v8.alpha = 0;
UIView *v9 = [[self subviews] objectAtIndex:9 ];
v9.alpha = 0;
UIView *v10 = [[self subviews] objectAtIndex:10 ];
v10.backgroundColor = [Function colorWithHexString:@"#eae1d8"];
UIView *v11 = [[self subviews] objectAtIndex:11 ];
v11.alpha = 0.0;
UIView *v12 = [[self subviews] objectAtIndex:12 ];
v12.alpha=0.6;
[self setNeedsDisplay];
}
UIPickerView自定义背景的更多相关文章
- 制作自定义背景Button按钮、自定义形状Button的全攻略(转)
在Android开发应用中,默认的Button是由系统渲染和管理大小的.而我们看到的成功的移动应用,都是有着酷炫的外观和使用体验的.因此,我们在开发产品的时候,需要对默认按钮进行美化.在本篇里,笔者结 ...
- listview自定义背景以及item自定义背景
item向自定义背景,可以根据position来设置不同的背景. listview背景设置是需要注意设置下面这几项: //点下时整个页面的背景 android:cacheColorHint=" ...
- Android-重新包装Toast,自定义背景
Android-重新包装Toast,自定义背景 2016-4-27 Android L 算是包装了一个自己使用的小工具. 使用Toast的目的是弹一个提示框.先看一下Toast.makeText方法. ...
- vscode自定义背景颜色
vscode自定义背景颜色 大概做前端的builder(只会打代码的才是coder,嘻嘻~)一半以上都会使用vscode编辑代码吧,vscode很轻量,支持的文件拖拽加入编辑区功能我个人认为很方便 ...
- IOS第11天(2:UIPickerView自定义国旗选择)
国旗选择 #import "HMViewController.h" #import "HMFlag.h" #import "HMFlagView.h& ...
- GUI(自定义背景图片)
如果组件中没有setIcon(...);这个方法,这是有需要给组件设置背景图片,这时就可以自定义绘制背景图片 /** * */ package com.niit.javagui; import jav ...
- UIPickerView去掉背景上的黑线
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger) ...
- UIDatePicker自定义背景
selectDatePicker = [[UIDatePicker alloc]init]; selectDatePicker.frame = CGRectMake(0, 10, 280, 21 ...
- UITabBar实现自定义背景及UITabBarItem自定义图片和字体
UITabBarItem *firstItem = [[UITabBarItem alloc]initWithTitle:]; //设置字体颜色(后面设置字体状态)(UITextAttributeTe ...
随机推荐
- CentOS下启动Tomcat
http://tianlihu.iteye.com/blog/2010028 1. Tomcat的部署包存放的路径 /var/lib/tomcat6/webapps/ 2. Tomcat的配置文件路 ...
- phpcms站---去除域名绑定目录中的HTML
原网址:http://www.xker.com/page/e2014/1207/148536.html 打开 \install_package 打开 \caches\configs 目录下的 syst ...
- OpenFlow Switch学习笔记(四)——Matching
这次我们着重详述来自于网络中的数据包在OpenFlow Switch中与Flow Entries的具体匹配过程,以及当出现Table Miss时的处理方式,下面就将从这两方面说起. 1.Matchin ...
- Xen虚拟机磁盘镜像模板制作(一)—Windows Server 2008(2012)
这段时间一直在研究如何制作一个适合Xen虚拟化的Windows Server 2008(2012)磁盘镜像,中间虽然遇到了一些阻挠,不过最终还是顺利解决,成功制作出了Xen Windows Serve ...
- JAVA 打印指定月份日历
package learnExercise; import java.util.Scanner; public class PrintCalender { /** * @param args */ p ...
- Spring AOP配置文件
在<aop:config>...</aop:config>报错: Multiple annotations found at this line: - cvc-complex- ...
- 了解 C++ 默默编写并调用的函数
前言 对于一个类来说,最最基础的三类成员函数莫过于:构造函数,析构函数以及拷贝函数 (copy构造函数和=重载函数).即使你的类没有为这些函数做出定义,C++ 也会自动为你创建.本文将讲述的是 C++ ...
- hdu 5206 Four Inages Strategy
题目大意: 判断空间上4个点是否形成一个正方形 分析: 标称思想 : 在p2,p3,p4中枚举两个点作为p1的邻点,不妨设为pi,pj,然后判断p1pi与p1pj是否相等.互相垂直,然后由向量法,最后 ...
- ZOJ 3878--解题报告
题目相关: 3878相关链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5526 Edward 打字员习惯于QWERTY键 ...
- Prepared Java infrastructure for distributed scenarios
code is sited on: https://github.com/zhoujiagen/javaiospike progress 2015/5/27 Nio/Nio2 examples, us ...