UITableView具有UIColorWithImagePattern奇怪效果的可滚动背景

UITableView具有UIColorWithImagePattern奇怪效果的可滚动背景,uitableview,ios5,background,uicolor,ios6,Uitableview,Ios5,Background,Uicolor,Ios6,我试图在UITableView中设置一个与表格一起滚动的背景。建议的方法之一(来自先前的研究)是使用: self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]]; 不幸的是,这是iOS 5.1的结果: 原始背景应为: 显然,这个问题并不影响iOS6。你知道如何在iOS5中修复它吗?在我看来,你的章节页眉和页脚视图都是乱七八糟的。是否正确设置了

我试图在UITableView中设置一个与表格一起滚动的背景。建议的方法之一(来自先前的研究)是使用:

self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]];
不幸的是,这是iOS 5.1的结果:

原始背景应为:


显然,这个问题并不影响iOS6。你知道如何在iOS5中修复它吗?

在我看来,你的章节页眉和页脚视图都是乱七八糟的。是否正确设置了以下委托方法?iOS5有一个问题,就是如果没有设置它们,就将它们设置为默认值。不过,我对iOS6不太清楚

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section 

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section 

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section 

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 

我应该把它们和对超级类的转发调用放在一起吗?我的意思是类似-(NSString*)tableView:(UITableView*)tableView titleForHeaderInSection:(NSInteger)section{[super tableView:tableView titleForHeaderInSection:section];}你知道有没有其他方法可以设置与表格一起滚动的背景视图?没有。你必须实现它们。例如,您必须在titleForHeaderInSection中设置标题并返回它。如果不需要页眉,则必须返回nil,否则它将创建默认页眉/页脚。你可以设置高度,如果你想其他明智的默认是44我想。我记得当uitableview高度超过480时,背景视图出现问题!视图在480后为空,但我使用的是backgroundImage属性而不是背景色。然后,我们创建了与uitableview相同的背景视图图像高度,效果很好。对于您的情况,您似乎只需要设置bkg颜色。此外,如果您将tableview.background颜色设置为浅灰色,并实现这些方法,则背景视图将完全符合您的预期。