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 ...
随机推荐
- Note Pad++ 关闭语法错误时在代码下面的红线标识
菜单栏 —- 插件 —- DSpellCheck . 将勾去掉即可
- MySQL 添加列,修改列,删除列
创建后表的修改 alter table 语句用于创建后对表的修改, 基础用法如下: 添加列 基本形式: alter table 表名 add 列名 列数据类型 [after 插入位置]; 示例: 在表 ...
- Debian 入门安装与配置1
Debian 入门安装与配置1 最近安装了多个发行版本的Linux,包括Ubuntu.Fedora.Centos和Debian,发现只有Debian在界面和稳定性等综合特性上表现最优,自己也最喜欢,所 ...
- URI与URL区别
URL 与 URI 很多人会混淆这两个名词. URL:(Uniform/Universal Resource Locator 的缩写,统一资源定位符). URI:(Uniform Resource I ...
- Linux Command Line 备忘
1. 如果要删除目录, rmdir or rm -d 或许可以删除空目录,但是只有 rm -R 可以把目录以及其内容连带删除! 2. 查看文件大小: ls -l --block-size=G 还可以换 ...
- Vimium 快捷键记录
, <c-e> : Scroll down k, <c-y> : Scroll up h : Scroll left l : Scroll right gg : Scroll ...
- 更改SAP GUI 登陆背景
您也可以定制初始屏幕(SAP Easy Access): 所有用户的全局设置:o 更改位于初始屏幕右侧的登录 - 如果希望将登录放置在初始屏幕右侧,请按如下处理: 使用事务 SW ...
- 111. Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shor ...
- 横向滚动条展示 css
<div class="shuaixuan" style="overflow:hidden;"> <div style="ov ...
- HTTP详解(2)
HTTP详解(2)-请求.响应.缓存 分类: 网络知识2013-03-17 16:45 1969人阅读 评论(0) 收藏 举报 目录(?)[+] 1. HTTP请求格式 做过Socket编程的 ...