刚接触ios的时候已经ios6了,遇到一个兼容ios5和ios6的问题。
在iOS6中,对于UITableViewStyleGrouped类型的UITableView,通过直接修改继承自UIView的backgroundColor属性的方法来设置UITableView的背景色无效。
比如,在AppDelegate中设置窗口的颜色为淡黄色
self.window.backgroundColor = [UIColor colorWithRed:1.00f green:0.91f blue:0.82f alpha:1.00f];
在一个UIViewController的viewDidLoad方法中增加一个UITableView,设置其backgroundColor为透明色。
UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style: UITableViewStyleGrouped];
tableView.dataSource = self;
tableView.delegate = self;
tableView.backgroundColor = [UIColor clearColor];
[self.view addSubview:tableView];
那么在iOS5及之前版本的模拟器上,运行的效果如下:
因为UITableView的背景色设为了[UIColor clearColor],所以tableView的背景色为UIWindow的颜色。
但是在iOS6模拟器和运行iOS6设备上的显示效果如下:
此时UITableView的背景色为默认的灰色,我们通过backgroundColor设置的背景色无效。
这个问题只在UITableViewStyleGrouped类型的UITableView中出现,UITableViewStylePlain类型的tableView没有这个问题,因为Group类型的TableView有个backgroundView,而plain类型的TableView没有(backgroundView属性为nil),目前看来,这可能因为backgroundView在中间挡住了背景色,这是否iOS6的bug还待确认。关于backgroundView,还可以参考下这里iPad Table backgroundView。
目前对于这个问题的解决方法是将Group类型的tableView的backgroundView设为一个新的空白View或简单的设置为nil.如下
tableView.backgroundView = [[UIView alloc]init];
tableView.backgroundColor = [UIColor clearColor];
或
tableView.backgroundView = nil;
tableView.backgroundColor = [UIColor clearColor];
参考:
UITableView clearColor background not working
iPad Table backgroundView
相关推荐
实现了简单的分组tableView,显示的是省份-城市关联信息,测试数据使用plist属性文件保存。 另外实现了类似iPhone通讯录根据字母快速索引联系人的功能,这里是点击右侧的省份名称,快速定位到其下辖的城市列表。
IOS TableView Grouped 例子 http://blog.csdn.net/totogo2010/article/details/7645693
列表-UITableView背景随动 列表类》》自定义Table View折叠效果 列表类-FormInputAccessoryView 列表类-Grid TableView 列表类-Grouped TableView With Shadows 列表类--iOS 6.0 Pull to Refresh 列表类--Section...
storyboard 绘制 tableview 的demo 对于熟悉iOS storyboard 开发 理解 UITableViewController有帮助。 xcode 4.3.2 上测试通过 网上看了这么多例子,自己整理的,不容易啊,分享了。
支持2种样式: standard -类似于UITableView纯样式和grouped -类似于UITableView insertGrouped样式 垂直和水平放置。 按颜色类型的属性,缩进也可以自定义。 如果您喜欢此库,请不要忘记加★ star ,这将对我的...
grouped_table.json
像任何其他Highcharts模块(例如,导出)一样,在Highcharts脚本标记下添加指向grouped-categories.js [removed]标记。 对于NPM用户: var Highcharts = require('highcharts'), HighchartsGroupedCategories = ...
Exploiting Domain Knowledge via Grouped Weight Sharing
grouped_data_by_newspaper.xlsx
Laravel开发-laravel-grouped-widgets Laravel分组小工具
Model selection and estimation in regression with grouped variables
序言 众所周知,iOS中消息推送扮演了不可或缺的位置。... Grouped notifications 推送分组 Notification content extensions 推送内容扩展中的可交互和动态更改Action Notification management 推送消息的管理
Laravel开发-collection-grouped-by-model 按模型分组的集合
Take a deep dive into rich media notifications, notification actions, grouped notifications and more.
Parallel_Grouped_Aggregation_in_DuckDB_-_DuckDB.pdf
Grouped and Multistep Nanoheteroepitaxy: Toward High-Quality GaN on Quasi-Periodic Nano-Mask
寄存器分组格式类型 用其他语言阅读:,。 这是古腾堡(Gutenberg)的库,用于提供注册分组的RichText格式类型的方法, 当同一组的格式类型数大于1时,将由DropDown收集。 仅当能够切换格式时,控件才处于活动状态...
来源:Licence:Unspecified平台:iOS设备:iPhone / iPad作者:Axel Schlueter 给grouped tableview的每个group的边框加上阴影。 Code4App编译测试,适用环境:Xcode 4.5, iOS 6.0。
custom_radio_grouped_button 自定义单选按钮和分组复选框按钮 自定义Flutter小部件,使复选框和单选按钮更加简洁 重大更改: 从1.0.2版开始 buttonColor is now unSelectedColor 正在安装 将以下内容添加到您的...