更改分组的UITableView的背景 [英] Change background of a grouped UITableView

查看:76
本文介绍了更改分组的UITableView的背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试通过组更改UITableView的背景时遇到麻烦.

I'm having some trouble trying to change the background of a UITableView with groups.

_tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"tableViewBg.png"]];

这通常可以在其他所有UITableView上使用,但不能在带有组的UITableView上使用,我还有其他事情要做吗? 在IB中,我将背景色设置为清晰的颜色,但这没什么用.

This usually works on every other UITableView, but not the one with groups, is there something else I have to do? In IB I have the background color set to a clear color, but that doesn't do much.

推荐答案

您还需要禁用_tableView的背景视图:

You additionally need to disable the background view of _tableView:

[_tableView setBackgroundView:nil];
 _tableView.backgroundColor = [UIColor redColor];

无需将新视图添加到backgroundView.这在iOS6中为我工作.

No need to add new view to backgroundView. This is working for me in iOS6.

这篇关于更改分组的UITableView的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆