UITableView 的一些效果 透明和section的高度
来源:互联网 发布:淘宝买伟哥会打电话 编辑:程序博客网 时间:2024/05/15 08:52
设置UITableViewCell半透明效果
这两天在鼓捣leaves(https://github.com/brow/leaves),看着那个tableview效果觉得不爽啊。想改成半透明的,搞了半天,最后发现被mainwindow.xib里的视图默认背景给害到了,我靠,默认是绿色的。。。我说怎么调alpha值都觉得不对劲呢。下面发一下改这个半透明修改的代码,高手请绕道吧,俺是新警察。
1. leaveappdelegate.m
在[window addSubview:viewController.view]; 之前加个背景,代码如下
UIImageView *cellImage = [[UIImageView alloc] init];
[cellImage setImage:[UIImage imageNamed: @"3.png"]];
cellImage.frame = CGRectMake(0, 0, 320, 480);
[window addSubview:cellImage];
2. 把mainwindow.xib的背景由绿色改为白色默认。
3. examplesviewcontroller.m
在init函数中加一句
self.tableView.backgroundColor = [UIColor clearColor];
在函数- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath中, 创建完cell之后设置cell.opaque = NO; //必须的
然后再加几句:
cell.textLabel.backgroundColor = [UIColor clearColor]; //必须的
cell.backgroundColor = [UIColor colorWithRed:(247.0/255.0) green:(151.0/255.0) blue:(121.0/255.0) alpha:.3]; //设置你想要的cell背景颜色,alpha是透明度参数
设置section的高度
http://www.tekuba.net/program/265/ 实在是那个页面复制不了东西了
0 0
- UITableView 的一些效果 透明和section的高度
- section 和sectionview 的高度
- IOS11以后,如何调整UITableView的section的高度
- UITableView选择UITableViewStyleGrouped时 section的高度设置
- 自定义Section:修改UITableView的Section的背景和字体
- 自定义Section:修改UITableView的Section的背景和字体
- 如果去掉UITableView上的section的headerView和footerView的悬浮效果
- UITableView刷新指定的section和cell
- 去掉UITableView Section上Header的粘滞效果
- UITableView的使用(UITableViewCell\section页眉\section页脚复用、sectionHeaderView点击效果)
- UITableView的使用(UITableViewCell\section页眉\section页脚复用、sectionHeaderView点击效果)
- 自定义UITableView的Section 的 title 的字体 和颜色
- UItableView的一些特殊点击效果
- UITableView的section header view悬停和取消的方法
- UITableview 的自适应高度
- 获取UItableView中button所在的section和row
- 设置UITableView Section的背景颜色和字体颜色 ----------自
- 【iOS】UITableView中section的展开和收起
- 机器学习手记[11]---PCA变换基础
- Linux错误码整理
- C语言从txt文件中逐行读入数据存到数组中
- Text Editor: The Basic of Basics
- hdu 3468 Treasure Hunting【二分匹配+最短路】
- UITableView 的一些效果 透明和section的高度
- C语言中字符串常量到底存在哪了?
- Column based selection in rich edit control.
- l蓝桥杯备战- Huffuman树
- C++标准库简介
- ANT命令总结
- 《unix高级环境编程》线程控制——线程取消选项
- 微信公共平台与正则表达式
- 大型视频监控系统双链路冗余网络设计缺陷故障处理